TDDを効果的に実践することは、Red-Green-Refactorサイクルを知るだけではなく、小さなステップを踏む、適切なテストを書く、リファクタリングのステップを適切に行う、そしてTDDがどこに適用可能かについて判断を持つことが必要です。うまく実践すれば、優れた設計と高品質でよくテストされたコードを促進します。
規律あるサイクル
1. RED — write ONE small failing test for the NEXT bit of behavior (run it, see it fail —
confirms the test works and the feature is missing)
2. GREEN — write the SIMPLEST code to pass (don't over-engineer; even "fake it" first)
3. REFACTOR — now improve the design (remove duplication, clean up) with tests as a safety net
→ SMALL steps; one behavior at a time; stay in short cycles.
