tdd-workshop/fizzbuzz/README.md
fiatcode c3355063f2 Initial commit: Complete TDD workshop materials
- Workshop documentation (WORKSHOP_PLAN, FACILITATOR_GUIDE, etc.)
- FizzBuzz kata with demo script (git history to be recreated)
- Password Validator kata with demo script and solution
- Shopping Cart kata with demo script and solution
- Setup guide and TDD reference card for participants
2026-03-10 15:32:21 +07:00

1.6 KiB

FizzBuzz Kata - Live Demo

Purpose

This kata is designed for live demonstration during the TDD workshop introduction. It shows the RED-GREEN-REFACTOR cycle in a familiar problem that requires minimal explanation.

The Rules

Write a function that converts numbers to strings according to these rules:

  • Numbers divisible by 3 → "Fizz"
  • Numbers divisible by 5 → "Buzz"
  • Numbers divisible by both 3 and 5 → "FizzBuzz"
  • All other numbers → the number as a string (e.g., "1", "2")

Git History as Teaching Tool

This kata is built with 12 commits showing each step of the TDD cycle:

git log --oneline --all

Each commit shows either:

  • RED: A failing test
  • GREEN: Minimal code to pass
  • REFACTOR: Code cleanup (if needed)

Using This for the Demo

See DEMO_SCRIPT.md for detailed talking points and timing guide.

Running the Tests

dart pub get
dart test

Checking Out Individual Steps

To see the code at any point:

git log --oneline                    # See all commits
git checkout <commit-hash>           # Jump to that step
git checkout main                    # Return to final solution

The "Aha!" Moment

Notice how the simple tests (1, 2) led to a general solution (n.toString()), and the Fizz/Buzz tests forced the algorithm to emerge naturally. We never designed the whole solution upfront—the tests revealed it step by step.

For Facilitators

This is your warm-up kata. Practice it a few times before the workshop so you can live-code it smoothly while talking through your thinking process.