Design the Classes for an Elevator Bank in an Office Building

Last updated: November 29, 2026

Quick Overview

Model a controller for a bank of elevators in an office building. Support hall calls with a direction, car calls from inside, choosing which elevator answers a hall call, and a simulation step that moves elevators.

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

0

0

0 solved


Model a controller for a bank of elevators in an office building. Support hall calls with a direction, car calls from inside, choosing which elevator answers a hall call, and a simulation step that moves elevators.

Object-oriented design questions like this are a long-standing part of Microsoft onsite loops. The interviewer checks clean responsibilities between controller and elevator, a sensible scheduling policy (LOOK or SCAN) instead of first-come-first-served, and the ability to extend the design for things like capacity or service modes.

What the Interviewer Expects
  • Separates the dispatching controller from per-elevator movement state
  • Uses an explicit direction enum and stop set per elevator
  • Implements a LOOK-style policy that serves stops in the travel direction before reversing
  • Chooses an elevator with a reasoned cost function
  • Discusses extensions such as capacity, express floors, and maintenance mode
Key Topics to Cover
object-oriented design
scheduling
state machines
LOOK algorithm
separation of concerns
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 handle an elevator going out of service with pending stops?
  • How would you optimize for morning peak when most traffic starts at the lobby?
  • How would you test the scheduler deterministically?
  • Where would the State pattern help?
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
  • N elevators, F floors.
  • hall_call(floor, direction) picks an elevator and returns it.
  • car_call(elevator, floor) adds a stop from inside a car.
  • tick() moves every elevator one floor and re...
High-Level Design
  • Direction enum: UP, DOWN, IDLE.
  • Elevator: current floor, direction, set of stops. Owns its movement policy (LOOK: keep going while there are stops ahead, then reverse; go idle when empty)....

Submit Your Answer
Markdown supported