Object-Oriented Model for Menu Items, Modifier Groups and Pricing Rules

Last updated: November 29, 2026

Quick Overview

Design classes for a restaurant menu where items have modifier groups with minimum and maximum selections, options can be out of stock, and pricing rules (such as the first topping free) apply to a cart line; implement validation and pricing.

DoorDash
Software Engineering Fundamentals
Software Engineer
DoorDash
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Medium

0

0

0 solved


Design classes for a restaurant menu where items have modifier groups with minimum and maximum selections, options can be out of stock, and pricing rules (such as the first topping free) apply to a cart line; implement validation and pricing.

Menus are one of the most complex domain objects at DoorDash, with nested options, availability and promotions. This low-level design round checks that you separate data (items, groups, options) from behavior (validation, pricing rules), keep the model open for new rule types, and write code that rejects invalid carts with clear messages.

What the Interviewer Expects
  • Identify the core entities and their relationships
  • Put validation next to the data it constrains
  • Model pricing rules as a strategy interface
  • Use immutable value objects for options
  • Keep money in integer cents
Key Topics to Cover
object-oriented design
strategy pattern
validation
domain modeling
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you support nested modifiers (a side that itself has a size)?
  • How would you version menus so an in-flight cart is priced on the version it was built from?
  • Where would tax and store-level promotions live in this model?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Entities: MenuItem (base price, groups), ModifierGroup (min, max, options), Option (price, in_stock), CartLine (item, selections, quantity, rules).
  • Validation: selection counts per group, ...
High-Level Design

Option is a frozen dataclass because options are values. ModifierGroup.validate owns its own constraints, so CartLine.validate just delegates to each group and checks for stray group ids. `Prici...


Submit Your Answer
Markdown supported