Skip to main content

Code Katas

Attempt these five tasks before opening feedback. Keep a contract, observation, candidate change, alternative and verification limit. These P tasks are required; extra lesson drills are targeted repair or optional depth.

P16: Implement two representations​

Implement BalanceAccount and LedgerAccount with the shared public contract. Use an independent scalar model on operation sequences and document representation costs.

P17: Inject a policy​

Implement quote with two unrelated callable rates. Check invalid input before the provider is called, provider error propagation and invalid result rejection.

P18: Implement a reliable snapshot​

Implement stable account history and demonstrate independence between old snapshots, new snapshots and two account instances. Test nested mutability separately with the lesson counterexample.

P19: Specify a report boundary​

Implement render_report and write_report for finite one-shot input, customer text containing markup, invalid late rows and a failing iterator. Explain the sink failure limitation.

P20: Write a reviewable decision​

Use the supplied legacy fixture or a small owned file. Choose one actual change pressure, compare two solutions including keeping the design, classify preserved/changed behavior and define a revisit trigger.

Reuse lab evidence and record assistance. If a book gap remains, locate the topic through the Refactoring book index and the selective reading guide.