test-driven development TDD
The tenets of TDD are simple:
? Code is written only when there is a failing test that requires the code to pass
? The bare minimum amount of code is written to ensure that the test passes
? Duplication is removed at every step
? Once all tests are passing, the next failing test is added for the next required functionality.
These simple rules ensure that:
? Your code develops organically, and that every line of code written is purposeful.
? Your code remains highly modular, cohesive, and reusable (as you need to be able
to test it).
? You provide a comprehensive array of tests to prevent future breakages and bugs.
? The tests also act as specification, and thus documentation, for future needs and
changes.