Skip to main content

Design Experiments and Changed Assumptions

Budget 6–9 hours across three experiments. Reuse lab code and P-task reasoning. Record predictions before running and keep all observations. Passing examples or one stopwatch result do not establish general design quality.

X1: same behavior, different representation​

On both account types, run the same valid and invalid command sequence. Compare results and snapshots after every step. Then vary history length h and the ratio of writes to balance reads. Explain cached O(1) reads versus derived O(h) reads, and tuple-append O(h) copying in the reference ledger. If timing, use repeated runs, identical inputs, recorded Python/environment and a stated measurement boundary. Separate code setup from the measured operation. Report distributions and retained outputs, not invented target numbers. Transfer: if the contract later requires bounded read latency, behavioral equality alone no longer settles substitutability.

X2: shallow snapshot versus stable value​

Run the nested-mutation example from lesson 17. Compare an outer tuple containing dictionaries with a tuple of integer amounts. Retain an old observation, mutate the source and record exactly what changed. State copy cost, element ownership and compatibility implications. Transfer: a live read-only view can be valid, but needs a differently documented contract; concurrency semantics remain separate.

X3: change-pressure experiment​

Compare a small central rate dispatch with supplied callable policies. Apply two changes: add a new rate, then add an operation that must examine every existing rate's metadata. Record touched decisions, public behavior checks and new concepts. If timing the changes, state your familiarity and order effects; a one-person exercise is not a causal productivity study. Transfer: defend keeping either design under a different expected extension axis.

Submit a compact table of prediction, observation, conclusion and unsupported claim for each experiment. Measurements and human review must remain distinguishable.