Object-Oriented Design of an AirPods Audio Route Manager

Last updated: November 29, 2026

Quick Overview

Design the classes that decide which output device (AirPods, Bluetooth speaker, CarPlay, wired, built-in speaker) is the active audio route as devices connect, disconnect, and leave the ear.

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

0

0

0 solved


Design the classes that decide which output device (AirPods, Bluetooth speaker, CarPlay, wired, built-in speaker) is the active audio route as devices connect, disconnect, and leave the ear.

Apple's audio stack has to pick routes automatically and still respect a user's manual choice from Control Center. The interviewer looks for clean modeling of devices and policy, deterministic tie-breaking, and observer notifications for the UI and playback engine.

What the Interviewer Expects
  • Separates the device model from the routing policy so the policy can change
  • Defines a deterministic priority: device kind, then recency of connection
  • Honors a manual selection until that device disappears or becomes unusable
  • Notifies observers only when the active route actually changes
  • Covers in-ear detection, the always-present built-in speaker, and duplicate connect events
Key Topics to Cover
object-oriented design
observer pattern
state management
policy vs mechanism
testability
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 routing calls and media to different devices at the same time?
  • How would automatic switching between a user's iPhone, iPad, and Mac fit into this design?
  • How would you unit test the policy without real Bluetooth hardware?
  • Where would you put per-app overrides, such as a navigation app that wants the car speaker?
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
  • Track connected devices and expose one active route.
  • Automatic choice: AirPods in ear beat other Bluetooth, which beats wired, which beats CarPlay, which beats the speaker. Ties go to the most rec...
High-Level Design
  • Kind (IntEnum) encodes priority so ordering is data, not if-chains.
  • AudioDevice is a dataclass with an is_usable() rule.
  • AudioRouteManager owns devices, connection order, the manual choi...

Submit Your Answer
Markdown supported