Getting Ready: Elevator System
Explore how to design a comprehensive elevator system using object-oriented principles. This lesson guides you through defining requirements, coordinating multiple elevators, managing capacity, and ensuring safety. You'll learn to break down the system components and think critically about optimization, reliability, and user experience in elevator design.
Problem definition
Elevators are essential in multi-story buildings, enabling the efficient movement of people and goods. A typical system includes one or more elevator cars that respond to user requests from call buttons on each floor and destination selections inside the car.
To ensure efficiency and safety, an elevator system must handle requests intelligently, minimize passenger wait times, respect car capacity, and support centralized and decentralized control of multiple cars. The system must also manage concurrent requests, optimize car movements, and provide real-time feedback through displays inside and outside the cars.
Robust safety protocols are critical: in emergencies like power failures or fire alarms, the system may need to ignore inputs and keep doors closed until operation is safe. Handling such scenarios correctly is essential for user protection and reliable operation.
In this LLD interview case study, you’ll focus on:
Multiple elevators coordination: Distributing requests among cars and managing their interaction.
Request scheduling: Prioritizing and queuing floor requests.
Capacity management: Preventing overloading.
Real-time updates: Showing current floor, direction, and occupancy.
Safety and fault tolerance: Managing emergencies and critical faults.
User experience: Minimizing wait times, supporting up/down requests, and providing clear information.
This elevator system case study requires you to design a scalable, reliable, and user-friendly system that can be adapted to different building sizes and requirements.
Expectations from the interviewee
Numerous components are present in a typical elevator system, each with specific constraints and requirements. Interviewers look for your ability to break down and design the system, anticipate real-world scenarios, and identify components and interactions. Typical areas of exploration include:
Multiple elevators
You can also ask the interviewer whether the system should handle multiple elevators or just a single one. For this, you can ask the following questions:
Can there be multiple elevator cars in the building?
How could a one-elevator system differ from a multi-elevator system regarding user wait time and running cost?
Display
You may want to ask the interviewer about the display of the elevator system:
How will users request elevators (call panels on each floor, selection panels inside cars)?
What information is shown on displays inside and outside the elevator cars (current floor, direction, occupied status)?
How do you keep users informed of the system state and updates?
Optimization
An interviewer would expect you to ask questions about optimizing the elevator system regarding wait time, maintenance, throughput, etc. You can ask questions like:
What strategies can minimize passenger wait times and unnecessary car movements?
How does the system handle peak hours and concurrent requests?
How do you optimize user experience and operational efficiency (energy use, maintenance)?
Reliablity and safety
You may want to ask the interviewer about the safety and reliability of the elevator system:
How does the system respond to faults, emergencies, or overloaded conditions?
What features ensure passenger safety at all times?
Design approach
In this case study, we‘ll take a bottom-up design approach:
Start small: Identify and design the smallest building blocks of the system, such as buttons, doors, and displays.
Compose larger components: Use these small components to assemble larger modules, such as the elevator car, request panels, and floor subsystems.
Integrate into the full system: Combine these pieces to design a building’s complete elevator control system.
Iterative refinement: At each stage, consider interactions, constraints, and edge cases; iterate and refine based on system requirements.
This approach helps ensure the design is modular, extensible, and robust, and makes it easier to adapt the solution for varying building types and requirements.
Design pattern
During an interview, discussing the design patterns that an elevator system falls under is always a good practice. Stating the design patterns gives the interviewer a positive impression and shows that the interviewee is well-versed in the advanced concepts of object-oriented design.
Try to answer the following question. If you are not familiar with design patterns, don’t worry! You can learn about them by asking questions like, “Define design patterns.”
Let’s explore the requirements of the elevator system in the next lesson.