Independent OOD Assessment
Allow 2–3 hours for an initial attempt, including review. This is a planning estimate, not a speed gate. Close keys and reference implementations; record notes/tools used. Use public behavior and concrete counterexamples rather than principle names alone. See the per-competency rubric.
A01
A 70-line pure tax calculation and a 15-line coordinator are flagged by a size-based tool. What evidence do you need before diagnosing low cohesion? Give a plausible keep decision for one and a candidate split for the other.
A02
An account starts at 8 USD minor. It deposits 2, returns history to a caller, then withdraws 5 and rejects withdrawal of 9. State the balance/history after every step and what the retained history must show. Explain why a tuple of mutable records needs a further guarantee.
A03
A provider promises successful withdraw for any nonnegative amount not exceeding the balance. A subtype adds a minimum withdrawal of 2. Give a violating client sequence. Explain how the answer changes if the original contract explicitly permits that minimum.
A04
A service accepts a database object in its constructor but imports its vendor Row and ConnectionError types into policy. Explain injection versus inversion and propose a narrow boundary owned by the consumer. Give one limitation of an in-memory fake.
A05
A compiler has a fixed set of syntax-node variants and frequently gains new analysis passes. Compare a central visitor/match with putting every new operation on each node class. State the opposite change pressure that could reverse your choice.
A06
A rename changes dict["user_id"] to user.id and publishes a new method name. Separate the changes and describe verification beyond successful compilation.
A07
A streaming renderer writes its header, consumes a row generator and then computes a total in a second traversal. Diagnose both successful-input and late-failure behavior. Propose a contract and explain its memory and external-write limits.
A08
A frozen Money dataclass contains a float amount and a mutable metadata dictionary; plus asserts equal currency. Identify the guarantees it does and does not provide, then specify a defensible small value type and accurate API documentation.
A09
You measure a derived-balance implementation once, then refactor to a cached balance and measure again. It is faster. Which conclusions are supported, which are confounded, and what invariant and measurements should accompany the decision?
A10
Your current account contract promises immutable snapshots. A new caller needs a live read-only history and a second provider is only hypothetical. Propose a compatible evolution, compare one alternative and give the evidence that would make you revisit the decision.