It is very clear that for systems of reasonable complexity (i.e. anything beyond toy examples) that increasing the complexity by ten percent adds far more than ten percent to the time to deliver, and far more than ten percent to the required effort to deliver. Therefore fighting complexity at every opportunity pays dividends over the life of the product.
Occam’s Razor is one of the most powerful tools in our armoury. Each area of uncertainty adds complexity to the product, adding to the developers workload. Each unit test that delivers certainty simplifies the developers work load. Each opportunity to simplify missed adds cost to the project for all developers. This is one reason why refactoring not only reduces technical debt, but improves the ability to deliver. Just making the code more understandable – ie. simpler, without changing the functionality has changed the rate at which new features can be produced.
There is a limit though, for as Einstein said:
“Things should be a simple as possible but no simpler”
Albert Einstein
Tests which do not exercise the full gamut of the actions a user can take, or does not have data that replicates the real life complexity of trades may miss a wayward interaction. The trick is to have the bulk of the tests test the small simple rules that compose to form the complex byzantine rules that many real systems exhibit, and have a smaller number of tests which check that the rules are connected up correctly.
Back this up with running through last years data set looking for differences and you have a solid set of tests at reasonable effort…
What do you do to make sure that you develop faster with confidence?
Recommended reading
A few books to help you produce clean well factored code that is a joy to test!
- Clean code: A classic. Focuses on the right things. Really helps you to be a better programmer. From the Master.. Uncle Bob
- Refactoring: From Martin Fowler, Kent Beck, et al – One of the Agile classics.
- Growing Object Oriented Software Guided by Tests: An advanced TDD book, from some of the ultimate experts. Nat and Steve introduced the JMock framework amongst other accomplishments
- Working Effectively with Legacy Code: Big ball of spaghetti, and don’t know where to start? This book gives you a bunch of great strategies. Well worth getting through.