Back to the map

Module 22 · OOP in practice · Drill

OOP in practice drill

Scenario prompts that check whether oop in practice is usable under pressure. Answer out loud, then compare.

4 prompts20 minNew

0 of 4 graded

  1. Prompt 1

    Design the error-handling policy for an order service that calls a payment client, an inventory client and a database. Say which failures are exceptions and which are results, where each is caught, what is retried, and how you avoid leaking connections.

    Say your answer out loud first. Thirty seconds is enough.
  2. Prompt 2

    Pick the collections for an in-memory session manager: look up a session by token on every request, expire the session that times out soonest, list a user's active sessions, and evict the least recently used session when memory is full. Give each operation's cost.

    Say your answer out loud first. Thirty seconds is enough.
  3. Prompt 3

    You are designing a plugin API for exporters (CSV, Parquet, S3, BigQuery) that third parties will implement. Choose between an interface, an abstract class or both, show what goes where, and explain how you will add a 'flush' operation next year without breaking existing plugins.

    Say your answer out loud first. Thirty seconds is enough.
  4. Prompt 4

    A pricing engine is a hierarchy of 40 Promotion subclasses with mutable state, and every new analysis (preview, audit trail, conflict detection) needs a new method on all 40 classes. Propose a redesign that mixes object-oriented and functional styles, and justify it with the expression problem.

    Say your answer out loud first. Thirty seconds is enough.
OOP in practice drill · Backplane