Protect your invariants — A practical TDD session
summary
Builds a bowling-score evaluator using strict TDD (red–green–refactor) with unit tests driving a Game composed of Frame types: nine intermediate frames and one tenth frame, enforcing invariants (max 10 pins per roll, frame sum ≤10, tenth frame allows 2–3 rolls). Implementation throws on illegal rolls, calculates spare/strike bonuses by peeking next one or two rolls, supports 20 normal rolls, three-roll tenth, and a perfect 300; tests all pass.
AI-written summary · about
chapters (11)
- 0:00Start
- 5:11Rules of Tdd
- 5:22Phases in Test-Driven Development
- 5:46Green Phase
- 10:33Score Evaluation
- 18:51Where Should I Enforce these Invariants
- 30:53Paper Method
- 35:21Helper Method
- 52:23Get Maximum Tries Method
- 53:44Test with all Strikes
- 58:14Summary
related talks
28mTDD as if You Meant It
38mDeliver Better Code Faster With TDD
48mTDD - It's About More Than Just the Tests
01h 58mPragmatic TDD
01h 02mThe Three Laws of TDD are Useful and Incomplete
47mHow to Stop Testing & Break Your Code Base
45mTDD makes you a better everyday developer
16mFrom Implementation TDD to Behavior TDD
