Design a Multi-Device Smart Home Controller Object-Oriented Design Interview
Design an application that controls multiple smart-home device types (e.g., fan, TV) supporting generic ON/OFF commands common to all devices plus device-specific commands, extensibly.
1. Problem Statement
Design an application that controls multiple smart-home device types, such as a fan and a TV. Every device supports generic commands common to all devices (turn on/off), and some devices support additional device-specific commands. The prompt is intentionally open-ended: clarify and state your own assumptions about the exact command set before designing.
2. Live Coding Format
Work in the provided coding workspace while explaining your decisions to the live interviewer. Validation may use inline tests, examples, comments, or a verbal walkthrough.
3. Key Focus Areas
- 1Interface vs. abstract-base-class trade-off for shared device behavior
- 2Generic vs. device-specific command modeling
- 3Command dispatch/extensibility across heterogeneous device types
- 4Clarifying an intentionally ambiguous prompt
4. What Strong Candidates Should Demonstrate
- ✓Decide deliberately between an interface and an abstract base class for shared device behavior, and justify the choice.
- ✓Design generic vs. device-specific command dispatch without a large conditional over device type.
- ✓Drive an intentionally underspecified prompt by asking targeted clarifying questions.
- ✓Add a new device type without modifying existing device classes (Open/Closed Principle).
Want interactive feedback?
Practice this problem in the live coding workspace while the interviewer probes your clarification, implementation, trade-offs, and validation.
Start Interview