Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Designing from a spec

โญโญโญ advancedโณ 10 min read๐Ÿ“ Lesson 191 of 256

One method per spec bullet, guards stated in one sentence, and every transition driven to every boundary.

Designing from a spec. The exam hands you a class diagram or a prose spec; your implementation is graded behavior-by-behavior. The workflow:

  1. List the fields with types (from "the register tracks..." โ€” a count? a list? a total?).
  2. One method per bullet in the spec; do not invent extras the spec did not name (the rubric cannot award them).
  3. State the guard for each transition in one sentence before coding ("arrive fails when full OR plate already present").
  4. Order of events: a scoreboard that processes a foul then a goal is a different state than goal-then-foul only if the spec says order matters โ€” decide, then code.

And the testing discipline: after implementing, drive every transition to every boundary โ€” full, empty, duplicate, missing โ€” because the hidden tests were written by someone who thought of them first.

โšก Now practice

Ready to Code
State machine labThree class designs driven to every boundary; state transitions are the whole exam.
3 challenges ยท ยท ~65 min