The second rule, “Eliminate duplication”, looks more confusing. In general, it is the Refactoring phase, which means that we should keep our code clean using standard Refactoring methods like extract method.
However, in details, this rule was the source of many misunderstandings in our dev team. It is essential to understand it deeply.
As we found out that “Eliminate bulgaria mobile number duplication” is something more than typical Refactoring. It is more about decoupling the tests and production code by removing duplication between them.
should be as much independent of each other as possible. The reason for doing so is to make it possible to write the next test with minimal effort. If you feel that it is not entirely clear to you, you should look to the book and analyze how Kent Beck is doing it.
Those two mentioned rules are the roots of TDD. They are simple, but as Kent describes the implication of them is a sophisticated rhythm of code development.
They lead to Red, Green, Refactor cycle known as TDD-cycle.
They allow us to focus on a small scope of our problem.
On each new test, we decide how big scope of our problem the test should cover. It should depend on our confidence. If we know exactly what to do, we can try to cover bigger scope but if we fell that we don’t fully understand the domain of the problem we can start from a smaller one.
Two simple rules imply a sophisticated process
-
- Posts: 15
- Joined: Mon Dec 23, 2024 3:56 am