Notes about the Test-Driven Development
Notes to my future self about the Kent Beck's book TDD by Example. Part I - The Money Example Kent Beck show us how he works in this part. The routine is: Quickly add a test. When writing the test, we imagine we have a perfect API for our operation. If the first test is too much for us to chew at once, test a smaller prerequisite first. See it fail. Make a little change to make it pass. See it pass. Refactor to remove duplication. We quickly see that by following these steps the problem at hand is divided into very small and simple steps . This is useful e.g. if we are distracted a lot. The tests tell us where to continue. Also the small size of the steps reduces "fear" (how Beck calls it). However we are not forced to do the steps these small. We can go at any speed. But when things get weird, we can fallback to really small steps. I'm not very fond of how Beck calls lots of code smells Duplication . The problem is in dependency between the test code and the implemen...