Library / Computational Thinking DPF
Jump to passage
In this reading

Link to current text

Published source confirmed at last check

Source changed 2026-10-03 05:29:54 UTC · snapshot created 2026-10-03 05:30:57 UTC · last check 2026-10-03 06:00:20 UTC

CMP.3:8 - Common Anti-Patterns and How to Avoid Them

Misstep exposed by the methodConsequence and repair
Key a subproblem by its position across changing inputsThe edit-distance example reuses an answer to another question. Bind the key to the input and conditions or narrow the cache’s lifetime.
Treat an in-progress entry as an answerA cyclic dependency can return unsupported content. Keep completion explicit and supply the appropriate cycle-solving method.
Discard predecessors while promising a witnessThe optimum value remains but the attaining object cannot be returned. Retain choices or construct a reconstruction pass.
Share effects as if they were pure calculationsObservations, updates or random dependence can change. Identify the fixed data calculation that is actually interchangeable.