Problem statement
Design the object model and control APIs for a garage door opener that drives a motor between open and closed, reverses on obstruction, and can auto-close after a delay.
Operating context. One controller drives one door with a single motor and two limit switches (fully-open and fully-closed). Commands arrive from a wall button, a remote fob, and an app, all mapped to a single 'toggle' or explicit open/close intent. While the door is moving, a photo-eye or force sensor can report an obstruction; safety rules require the door to stop and, if closing, reverse to open. The door reports a state: closed, opening, open, closing, or stopped-midway. An optional auto-close timer shuts an open door after a configured delay unless an obstruction or a new command intervenes. Everything runs in-process on the controller.
Out of scope. RF pairing and rolling-code security for the remote, the app and its cloud endpoints, motor-driver power electronics, motion-sensor lighting, and multi-door / multi-bay coordination.
What to produce. The class hierarchy (controller, door state machine, motor actuator, limit switches, obstruction sensor, command source), the public API each class exposes, and the door's full state transitions. Be explicit about: how obstruction handling is expressed as safe transitions (stop, and reverse when closing), how the multiple command sources funnel into one command interface, and how the auto-close timer is modelled without a blocking wait.
Requirements
This assessment is a Premium feature.
The statement above is free to read. The functional and non-functional requirements, and the graded canvas that scores your design against them, come with Premium.
Topics
- System Design LLD
- Patterns State-Machine
- Patterns Command
- Oop Solid
- Iot Actuator