Financial AgileWhere software & financial engineering meet

Object-Oriented Testing: Somebody's Gotta Do It

Print

ootestingIn the summer I was teaching a couple of lads some object-oriented development.  To get them started I asked them to think about Myers’ Triangle challenge.  I then wrote a short note about it.  I was not trying to teach test-driven-development or anything as sophisticated.  It was more rudimentary.  We needed terms: test diver, assertion, test data, test data generator, etc..  We needed a starting point.

I try to be a writer.  I do it because I enjoy it, but it serves a purpose as a thinking tool and occasionally as a cathartic release.  Recently, I’ve been studying adaptation, moving from a story to a screenplay.  The adaptation of Silence of the Lambs has Lecter telling Starling,  

First principles, Clarice.  Simplicity.  Read Marcus Aurelius. Of each particular thing, ask: What is it, in itself, what is its nature...?

If you allow yourself to take advice from a fictional psychotic, you see that this isn’t bad advice.  Not at all.  This is what we do when we design or test, when we figure out how or why our colleagues do what they do.  What are the first principles?  Automation and process heavy test certifications are useless unless the person wielding these tools is always remembering his Aurelius: what is this thing unto itself?

Jorrit and I adapted the Triangle exercise into a workshop.  We did the first run on Wednesday, down in Rotterdam with some old colleagues of ours.  A good workshop allows the participants to collaborate and so the idea was simple.  I would give an introduction to the talk whilst people ate their lunches.  I reminded them about the nature of estimates using McConnell’s Cone of Uncertainty, but I also reminded the group about the co-evolutionary nature of problems and their solutions.  The workshop touched on a number of themes, really showing the pervasive nature of all projects, and how testing can positively affect them.

After a few moments, we broke into teams, came up with as many test cases of the Triangle as we could think of, swapped, and then kicked-off a discussion proper.  What alternatives to unit testing are there?  Two participants brought up the notion of good assertions within the Triangle object as a way to reduce the need for test cases (they were sort of inventing Design by Contract on the fly and, of course, had discovered the relationship between design and testing).  Beta-testing came up as did the idea of ‘one big unit test’.  As a whole system becomes clear, so too does the ability to act decisively on that system.  In this sense, because unit testing was discussed in relation to engineering management, the software process, the consumers (clients) and the producers (developers), the workshop succeeded.  If a client ‘gets’ that a day of testing now saves a week (or month) later, and if a developer ‘gets’ that you can produce better tests by collaborating with a domain expert, and if the team-lead ‘gets’ that all these different people need to be in the same room more often, then a company’s software capabilities will improve dramatically.

Further Work
Without straying too far from the Triangle, managers, leads, financial and software engineers can learn a lot.  Binder’s chapters 1, 13 and 17 are interesting because they deal with: the triangle, integration and assertions.  Understand 13 and 17 and you will are on the way to understanding XP’s technical practices.  Less theoretical and much more ‘open the book and get programming’ is Hunt and Thomas’ Pragmatic Unit Testing in C# with NUnit.  We recommended this the other day because our friends in Rotterdam are a .Net shop.  There is also a Java version of this book.

For those who are interested in a multimedia lesson in perspective, you could read Harris’ Silence of the Lambs in the week, browse the screenplay (link below) and watch the movie at the weekend, which is considered by many to be one the best of the last century.  Where did Crawford’s wife go?  What the adaptation shows you is that there is never one right answer.  Decisions we take on a project will dictate the outcome, which will only ever be one of an infinite set of possibilities.  Software projects are a series of adaptations, compromises, and constant re-jigging of our orginal story.  Refactoring is adaptation; porting from VBA to VSTO is adaptation; figuring out that pair programming is not working for you and shifting to formal review is adaptation.


Further Reading
Binder, R. (1999) Testing Object-Oriented Systems, Addison-Wesley.
Brooks, F. P. (2010)  The Design of Design, Addison-Wesley.

Cross and Dorst, 1999, ‘Co-Evolution of Problem and Solution Spaces in Creative Design’.

Myers, G. J. ((2004) [1976]) The Art of Software Testing.  Wiley.

Harris, T. (1997) The Silence of the Lambs, Mandarin.

Hunt, A, Thomas, D. (2007) Pragmatic Unit Testing in C# with NUnit

McConnell, S. (2006) Software Estimation: Demystifying the Black Art, Microsoft Press.

Tally, T.  (1989) ‘The Silence of the Lambs’.  Available in draft at: http://www.godamongdirectors.com/scripts/lambs.shtml

Internet Resources
Unknown author. (2010) ‘The Cone of Uncertainty’, Contrux.  Available from: http://www.construx.com/Page.aspx?hid=1648

Venners, B. (2004) 'Contract Driven Development, A Conversation with Bertrand Meyer, Part III', Artima.  Available at: http://www.artima.com/intv/contest.html.

Attachments:
Download this file (master deck.pdf)master deck.pdf[ ]3773 Kb07/10/10 11:12

Comments  

 
+2 #1 david 2010-10-08 14:10
Nice post. To tie into the theme of changing mental models (refactoring?), I can recommend reading The Art of Systems Thinking, J. O'Connor, I. McDermott (2001)
Quote | Report to administrator
 
 
0 #2 Jamie 2010-10-08 15:06
Thanks David, generous of you to share that (we like sharing here). I will have a look.

You may, if you can find the time, submit a book review. Sander sort of did that for his PeopleWare article. I can help you with editing.
Quote | Report to administrator
 

Add comment


Security code
Refresh

FUVIAZRFEB09F