Tier: 4 — Hard Domain: Financial Services / Trading Core Patterns: Command (orders), Observer (price alerts), Strategy (order matching/execution), State (order lifecycle), Factory Method (order creation)
Phase 1: Requirements & Use Cases
Interviewer: "Design the object-oriented model for an online stock brokerage platform."
Candidate: "Before I write a single class, let me frame the scope precisely. We're building the class-level domain model for a brokerage: the core objects, their responsibilities, and how they interact across the lifecycle of placing, executing, and managing orders. We are not designing a distributed trading engine, not covering market microstructure, and not building an API layer. The boundary is the class diagram and the interactions between in-process objects. Does that match your intent?"
Interviewer: "Yes. Class-level model. Proceed."
Candidate: "Great. Let me identify the actors first.
Primary Actors:
- Investor / User — a registered account holder who places and manages orders and views their portfolio
- Market (External Price Feed) — an external data source that pushes price updates into the system; we model its interface, not its internals
- Broker — the platform itself, acting as coordinator and enforcer of trading rules
- Admin — a privileged actor who can suspend accounts or halt trading on a security
Core Use Cases:
- Place an order — market, limit, or stop variants; buy or sell
- Cancel a pending or open order
- View portfolio — current positions, market value, unrealized P&L
- View order history — orders across all statuses with filtering
- Track realized and unrealized profit & loss per position
- Receive price alerts — notify…
In the full tutorial
- Phase 2: Object Modeling
- Phase 3: Class Design & Relationships
- Phase 4: Design Patterns Application
- Phase 5: Key Implementation
- Phase 6: Edge Cases & Follow-Up Challenges