TDD as if you Meant It: I care about Behavior and not about Representation (Episode 2)
TDD as if you Meant It: I care about Behavior and not about Representation (Episode 2)
About
Intentional Primitive Obsession
In the first episode I added some tests where I represent state as strings. This is an intentional approach to hide the complexity of the concepts with primitives. Since with TDD as if you Meant It I am not allowed to add any new classes, I need to start the problem by using primitives. I could have used an array to define the Board concept, but that already means that I am taking more complex design decisions.
Triangulating
I am focusing on triangulating on the concept of GameResult in order to have enough proof in order to extract it to a method. The typical proof I am searching for is duplication. I apply the Rule of Three to spot duplication and then to generalize my code.
Deductive vs Inductive
When doing evolutionary design I am deductive or inductive.
Inductive: I start from small concepts and I generalize them. Whenever I can can generalize some higher order concepts from the code I have, I extract them. These higher order concepts are usually a crystallization of the raw primitives.
Deductive: when doing design up-front I am deductive. I start from some bigger idea and then I try to prove it with code.


