When implementing features or fixing bugs, follow t-wada's TDD (Test-Driven Development) cycle to ensure high-quality code and maintainable tests.
t-wada's TDD Cycle
Basic 3 Steps
- •Red - Write a failing test
- •Green - Write the minimum code to make the test pass
- •Refactor - Clean up the code
Key Additional Elements
Gradual Evolution from Fake Implementation to Real Implementation
- •First, use "fake implementation" by returning constants to make tests pass
- •Next, apply "triangulation" by adding multiple test cases
- •Finally, move to "obvious implementation" through generalization
Importance of Small Steps
- •Don't implement large features at once; proceed in extremely small increments
- •Confirm tests pass at each step
- •Always maintain working code
Timing of Refactoring
- •Perform refactoring immediately after tests pass
- •Both test code and production code are targets for refactoring
- •Eliminate duplication and clarify intent
Test Naming
- •Express specifications through test method names
- •Actively utilize Japanese naming (in his Japanese context)
t-wada particularly emphasizes "progressing steadily with small steps" and "gradual evolution from fake implementation," which are his main customizations to Kent Beck's original approach. The key insight is his focus on the intermediate steps between Red and Green, breaking down the "make it pass" phase into more granular, manageable steps that reduce risk and maintain momentum.