skip to content rich footer

stevenclark.com.au

subscibe to the StevenClark.com.au rss feed

Keep an eye out for me on Facebook and Twitter

You Need More Than Unit Tests

More and more lately I’ve run across programming conversation in blog comments which indicate a worrying trend. Quite a number of programmers don’t seem to view internal or external documentation as important. But why? Here is a minimum level of documentation I would expect in a project regardless of the programming methodology of the developers…

Internal Documentation. Who wrote the code? When was it written and last amended? What does the code do – is it a class which defines the behaviour of bouncer balls in a beach ball game? These should be included in a comment at the top of every page of code. And let’s face it that takes around a couple of minutes so its not going to break anyone’s day typing it in there. The next level of internal documentation are comments before each method or function. This should at least describe the function and it would be good to have the expected inputs and outputs available so new people picking up the code don’t have to guess what you meant when you named the method integerQuad(int k, int l). Define the expected parameters k and l as well as the expected boundary cases. Don’t underestimate the next coder’s ignorance about the way you think (or you’re own ignorance early next week).

External Documentation. Again this should contain the details of who wrote and edited the code base. Why was it edited? Were there specific errors which caused the previous iteration to fail? There should be some form of error logging so that when Jimmy runs into the same problem June fixed last week he might find the solution in the documentation. Otherwise every person could be out there trying to reinvent the wheel as a series of one-man bands. And don’t forget version control.

Next you should be keeping time reports about your productivity. This can be used to hone down your quotes over time – how long does it take you to write a certain kind of class or method? Also, beyond creating documents which will aid your fellow programmers (or replacements) there should be user documentation written from an entirely different perspective.

That’s a very brief overview so please don’t shine me up like a quartz-halogen wigwam. The point is documentation has its place when you perform software engineering.

My concern then is where people pick up books and get the idea that unit tests are somehow entirely enough. No code comments required, no external documentation. My question is how much more expensive do you think it will be if nothing is documented? Its all fair and good to be a brilliant coder. You might be able to hack your arse into a five star code magician but at the end of the day you have to be a part of a team. Does that make sense? Unit tests have their place but they shouldn’t be the only artefact that tells how your project is stitched together. I’m sure your financing stakeholders would expect more than printed out unit tests to explain what you’ve achieved so far.

Anyway that’s my little rant for the day. I don’t understand how any professional programming related business can go without documentation even if there are unit tests coming out of the projects bum in superlative hiccups… eventually someone else is going to have to read that code and understand what you meant by integerQuad(int k, int l).

Comments are closed.

About the Author

Steven Clark Steven Clark - the stand up guy on this site

My name is Steven Clark and my passions are business, web development, photography and writing. My current CV [PDF 775KB] discusses relevant work history and interests. Currently I'm in the second half of a post-graduate university degree of MBA (Journalism and Media Studies) at the University of Tasmania.

Social Networks

Lo and behold I now happen to inhabit the realms of Facebook and Twitter so see you over there.

Photography

My fine art photography is available online at Steven Clark Studio. You may also enjoy my photo blog Walk a Mile in my Shoes.

Recently Reviewed Books

Site Supporters

Hosted by Brett Drinkwater at Tashosting who is always there at the other end of my every inconvenient question and technical crisis. Brett's local community support for us over the last five years is greatly appreciated.

skip to top of page
Currently Reading The Accidental Guerrilla by David Kilcullen

Late last year I watched an address to the Australian National Press Club from counter-terrorism expert and author of The Accidental Guerrilla: Fighting Small Wars in the Midst of a Big One , David Kilcullen. In that address he mentioned the period after World War 2 when, in retrospect, we had wars against colonialisation as countries pushed back against dominating forces. Similarly, when we look back at the current wars we’ll see them as wars against globalisation – people pushing back against the tide of world wide Americanisation and globalised culture. David Kilcullen is there to inform us that what the American government are group-labeling global terrorists are more often than not local insurgents with local concerns. Understanding this crucial point and unraveling the complexity of the enemy is crucial to America's success in the field.