Test Driven Development . For code to be easily tested, it must:
1) do only one thing
2) have as few dependencies as possible
3) often have those dependencies that were transmitted (so that they can be mocked)
By surprising coincidence, these factors also make for reusable code. Actually, this is not a coincidence - the best way to get a reusable code is to ensure that it is used by at least two subscribers as early as possible. Code created using TDD starts life with two parents — code under construction and unit tests, so it is reused from the very beginning.
TDD , - , , . TDD , , , .