Too Long; Didn't Read
Test-driven development (TDD) or just writing tests can make your code better. Let’s take a look at this effect with a simple example: moving an internal state of a class to a dependency. The most straightforward way of keeping a state is to add a private variable and put aside the values you need for later use. This will do the job, but it makes testing more difficult. To make the code more testable, we can define a separate class that will keep the state.