Skip to main content

Guided Labs

Download the offline kit. It includes starter, reference, independent checks, contracts and an evidence template. Python 3.10+ and the standard library are sufficient; no network is used by the kit.

Extract, open a terminal in behavioral-patterns, and run:

python run_labs.py --impl starter --lab L01
python run_labs.py --impl reference

The untouched starter fails intentionally. Complete starter one lab at a time; do not import reference as a solution. Predict a trace before execution, then record a failure, correction, independent check and limitation. Correct code alone does not establish independent reasoning. Full contracts live in README.md and this page.

LabBuild and demonstrateIndependent checkRequired transfer
L01Quote boundary, one policy call, exact units/types404 amount/rate cases and validation/failure tracesCallable versus stateful policy object; who owns cleanup?
L02Token subscriptions, idempotent disposal, snapshot delivery, nested rejection, reported failuresDuplicate registration and membership/error tracesImmediate removal policy and immutable versus shared payload
L03Text edits with undo/redo and immutable mementos1,296 four-action histories against version-list modelCursor state, no-op edits, memory budget and outside edits
L04Workflow transition matrix and accepted-record replayAll 16 cells and 256 four-event sequencesState classes versus table; stale review-generation guard
L05Lazy pages and independent cursors27 three-page size configurations and fetch-failure/early-stop tracesResource cleanup and finite versus unbounded empty pages
L06Ordered first-match decisions with explicit terminal denial64 three-handler outcome sequences plus malformed decisionsAll-checks-required pipeline and duplicate continuation
L07Num/Add/Mul visitors for evaluation and formatting125 arithmetic trees plus nested-layout and dispatch casesAdd Count, then Neg; compare edit surfaces

The checks enumerate finite domains. They do not prove arbitrary histories, crash durability, concurrency safety or absence of retained objects. Budget 24–36 focused hours including implementation, debugging and evidence. If a lab fails, repair the corresponding practice task and rerun a fresh case. The assessment requires explanations beyond these checks.

Runtime comparison: EventBus and Editor​

After core L02/L03, complete this required second package. The first package's snapshot-membership and no-op expectations must not be copied unchanged into it. Read the policy comparison. Its implementation/evidence allowance is 5–8 additional focused hours when reusing the core foundations, within the 10–16-hour merged comparison allocation.

Download the lab archive, extract it and open behavioral-contracts. Python 3.10+ and the standard library suffice. Windows users can substitute py -3 for python3.

python3 check.py starter

Initial NotImplementedError is expected. Implement the public EventBus and Editor methods using the contracts in starter.py and runtime lessons R1–R4. Choose your representation; a class per command or state is not required. The API is single-threaded, synchronous and in-memory.

Before runtime implementation​

Write expected traces for cancellation before a callback’s turn, registration during dispatch, nested publication, ordinary callback failure and close during dispatch. For the editor, draw the history after undo followed by invalid edit, no-op and real edit. Complete the trace practice first.

python3 run.py starter > results.json

Retain this report and additional traces from your failure cases. After an attempt compare reference.py and run python3 check.py reference. Checks include a separate past/present/future model over 1,296 four-action editor sequences, immutable snapshots, argument boundaries, subscription release and event lifecycle policies. Finite test success does not prove arbitrary callback behavior or thread safety.

Runtime submission​

Provide your implementation, actual traces, a repaired failure, help/source record and a brief decision note. Compare one alternative policy (for example callback snapshots versus token snapshots with live cancellation), explain which test must change, and state the ownership and storage costs. Reproduce from a fresh extraction and defend a changed case without the reference.

Reuse this packet as a semester-project appendix and assess it with BD1–BD6. The original broader pattern practice remains required. Do not use this local lab to claim durable delivery, atomic external effects or safe remote retries.