Tier: 4 — Hard Domain: Mobility / On-Demand Transportation Core Patterns: Strategy (pricing), State (trip lifecycle), Observer (notifications), Factory Method (ride types)
Phase 1: Requirements & Use Cases
Interviewer: "Design the object-oriented model for a ride-sharing service like Uber or Lyft."
Candidate: "Before I start designing, let me restate the problem to make sure we're aligned. We're building the class-level model for a ride-sharing system — specifically the core domain objects, their responsibilities, and how they interact to fulfill the lifecycle of a ride from request to payment. We're not building infrastructure, not designing APIs, not covering distributed concerns. Does that match your intent?"
Interviewer: "Yes, exactly. Class-level OOD. Go ahead."
Candidate: "Great. Let me identify the actors and use cases first.
Primary Actors:
- Rider — a registered user who requests rides
- Driver — a registered user who accepts and fulfills rides
- System — the dispatcher coordinating matching and lifecycle
Core Use Cases:
- Rider requests a ride — specifying pickup location, drop-off location, and ride type
- System matches the request to an available driver
- Driver accepts or declines the matched request
- Trip executes — tracking state transitions (en route, picked up, in progress, completed)
- Fare is calculated and applied to the rider's account at trip completion
- Riders and drivers receive notifications at key state transitions
I'd also note two out-of-scope items: real-time geolocation matching (requires spatial indexing, not OOD), and payment gateway integration (external service boundary, not domain logic)."
WHY: Geolocation matching is an algorithmic/infrastructure concern. The OOD question is about the…
In the full tutorial
- Phase 2: Object Modeling
- Phase 3: Class Design & Relationships
- Phase 4: Design Patterns Application
- Phase 5: Key Implementation
- Phase 6: Extensibility & Trade-offs