Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
TDD forces you to think about what your code (system) needs to do. By directly working from a list of requirements it keeps you focused and on track to meet those needs. The TDD cycle prevents you from running away on a tangent, as is so often easy to do.
Tests are quick to run, and run often. Almost instant feedback when something is wrong. Imagine coding a new feature or making a change on an unknown project, but one done in TDD. You would have feedback from the test, without needing to run up the Application that your change had worked and not caused any regression issues, or alternatively, that your change does not work as intended!
One of the cheapest places to fix a defect is in code, prior to deployment or release. TDD helps identify and weed out defects by ensuring test coverage (and test cases) are high, and removing duplication during the refactor phase leaves less places for bugs to hide.
Refactor with confidence – If the tests still pass, then no problem! How many projects have you worked on where that can be said with a degree of certainty. Refactoring is key to improve code, reduce code smells, identify possible bugs and generally keeping code as clean as possible (Boy Scout Rule).
TDD projects tend to be well written, cleaner and therefore easier to maintain. If not refactor!
TDD can be used to provide developer level documentation with well written and well named unit tests. Code is the best documentation, as you never have to remember to update it.
Once the initial learning curve is overcome (as with any new skill), TDD should actually speed up development, as making a change or adding a new feature becomes much easier on a well tested clean code base
It’s hard to write complex code when using TDD. Generally if a piece of code is hard to test, it probably can be improved. Because TDD focuses on meeting requirements and small incremental changes, its difficult to stray and add in over complicated or ‘might be required’ features.