KISS: Keep it Simple Stupid!

KISS: Keep it Simple Stupid!

Test Driven Development (TDD) is an approach to development in which you write a test that proves the piece of work you are working on, write the code required to pass the test and then update the design based on what you have learned.  The short cycle of TDD, Acceptance Test Driven Development (ATDD) or even Behavior Driven Development (BDD) deliver a variety of benefits to the organizations that practice these techniques.  Some of the benefits are obvious, while others are less apparent.

Fewer Delivered Defects:  This is probably the most obvious benefit to using any of the test-first techniques.  Testing finds defects, timelier testing is more apt to find defects before they get delivered and better testing tends to find more defects.  The benefit to fewer defects is customers that swear less often.

Communication:  This the second most obvious benefit. The process of developing tests creates a platform to ensure that the product owner, business analyst or stakeholders communicate the meaning of a user story before the first line of code is written. The process of developing the tests requires conversation, which is at the heart of Agile techniques. Better communication yields software better targeted to the organization’s needs.

Better Tests:  This benefit is related to delivering fewer defects, but is far less obvious.  Tests that are targeted at proving that the functionality being delivered or changed will be significantly more targeted and lean.  Whether leveraging the xP technique of pair programming or the Three Amigos technique, TDD (or any of the test-first techniques) ensures that the tests are reviewed early and often which helps to ensure only what is needed is tested.  Tighter testing will not only result in fewer delivered defects, but also less costly testing due to targeting.

Code Quality:  TDD, ATDD and BDD all encourage developers to write only the code needed to pass the tests.  The test-first techniques embrace the old adage “keep it simple stupid” through the refactoring step. By only writing as much code needed to pass the test, it will remain as simple as possible. This will yield higher code quality because there will be less chances to embed defects.

Less Dead Code:  The final and least obvious benefit of TDD is a general reduction of dead code.  When I worked in a development organization one of the things that drove me crazy was that amount of old dead code in the programs I interacted with.  Some code was commented out, left in “just in case” and some code had just become un-executable because of logic changes. Refactoring helps remove dead code making programs more readable and therefore easier to maintain. Writing simple, focused code, just enough to pass the test, makes it less likely that you will create dead code.

TDD, ATDD and BDD all deliver significant value to organizations that use these techniques.  ATDD and BDD with their additional focus on acceptance tests may encourage deeper communication between developers, testers and stakeholders. Regardless of which technique you use these test-first techniques improve communication and testing, providing teams with an ability to deliver more value and generate higher customer satisfaction.