Software Craftsmanship And Unit Testing
Sunday, 20th November 2011
I am reading Pete McBreen's Software Craftsmanship, a book with excellent insight into how the software development community needs to operate to transform itself into a true profession that delivers applications that users value.
There is a great deal of profound truth in this book, but what strikes me about the idea of Software Craftsmanship is an idea that is echoed in Robert Martin's Clean Coder: if we want to be taken seriously as software developers, we need to behave professionally.
Part of this is easy. We need to be trustworthy and we need to write quality code. Some parts are less easy. We need to be honest with our estimates, we need to give bad news as early as possible rather than hoping for a stroke of luck and we need to accept that some practices are fundamental to software developers being taken seriously as professionals.
One of the things we need to accept as part of this professional attitude towards software development is unit testing. Test-driven development isn't just about having repeatable checks you can run to verify the behaviour of your software, it is also a driver towards writing better, more cohesive units of code. On top of this, it also acts as documentation on what your software does and how it should be used.
If you consider unit tests to be a waste of time, consider this. If you wrote an application with absolutely no documentation, would that be a professional thing to do? Of course not - and I would rather write a good suite of unit tests than a verbose text document because of all the other benefits you get with it.
Some people believe themselves to be very gifted developers and think that they don't need to write tests. The sad thing is that although they may well be great developers, they are not professional developers because they aren't thinking of the other people who will be involved in maintaining the software. A professional developer understands that their co-workers will need to make changes to the software and that the tests will make this process easier.
If you truly want the status and respect of a professional, you must meet all of the expectations people have of a professional.