Skip to main content

Prerequisite Diagnostic

Attempt before the lessons. Do not use pattern names as answers. For each task, state an observation, a trace and one limitation.

  1. b = a for a mutable list. Mutate b. Explain what a sees and how an outer-list copy differs from copying nested mutable values.
  2. A function validates input, calls a dependency, then saves a result. The dependency raises. Which effects have happened and which have not?
  3. Two implementations have the same return values but one calls a clock twice. Describe a caller/test that distinguishes them.
  4. A four-state model has four event kinds. How many state/event cells need a declared outcome? Why is testing each cell insufficient for arbitrary histories?
  5. A test imports the implementation's expected-value table. Give a defect both could share and propose an independent oracle.

Feedback and repair​

  1. Both names refer to one list. A shallow copy separates its membership but shares contained objects. Repair with S3M1 ownership/alias exercises.
  2. Validation has completed and the dependency may have partially acted; the later save is skipped. A raised exception is not proof of no effect. Repair with S3M2 failure and uncertain-write traces.
  3. A fake clock returns different values and records count/order. Repair with S3M2 observation boundaries and extraction exercises.
  4. Sixteen cells. Stored history, guard data and stale callbacks can distinguish sequences reaching the same label. Repair with finite-state modeling from earlier algorithm work; no prior State pattern knowledge required.
  5. A wrong table cell agrees with itself. Derive expected behavior from a separately stated matrix or small enumeration. Repair with S3M2 oracle practice.

All five skills are needed. Repair each weak skill, then explain a fresh example without this page. Prior experience can shorten repair time; no aggregate score hides a missing prerequisite. Record assistance separately from independent work.