Write clean code that works [Kent Beck, 2003]

The TDD (test-driven development) is a methodology to guide the development focused on the quality. It will help to create a code more concise, coding only what is necessary.

TDD drive developers to write the test first and then implement code changes to passe by tests. The tests are done first instead of coding first and then try to fit the test to validate the code.

The cycles of TDD is:

  • Write a test to fail(“red”).
  • Write a test small enough only to pass (“green”).
  • Optimize the design (“refactor”).

Don't forget to run all the tests to ensure your changes don't break what was already done.

The most challenging part is the make everyone use it, mainly if the project is guided to delivery. However, as soon as the team or project matures, the quality will have priority and the TDD will gain space to be applied.


References