A Traffic Control Signal System is an automated system used to manage the movement of vehicles and pedestrians at road intersections by controlling traffic lights (red, yellow, green) in a coordinated and safe manner.
Its main objectives are to:
In this chapter, we will explore the low-level design of a traffic control signal system in detail.
Lets start by clarifying the requirements:
Before starting the design, it's important to ask thoughtful questions to uncover hidden assumptions and better define the scope of the system.
Here is an example of how a conversation between the candidate and the interviewer might unfold:
Candidate: Should the system handle just a single intersection or manage multiple intersections concurrently?
Interviewer: It should be able to manage multiple intersections, each operating independently but centrally monitored.
Candidate: Do we need to handle emergency scenarios like green light overrides for ambulances or fire trucks?
Interviewer: Not for this version. Assume normal conditions.
Candidate: Should the system simulate real-world timing for green, yellow, and red lights?
Interviewer: Yes. Each intersection should respect configurable durations for green and yellow lights. Red is implied by the other directions being green.
Candidate: Should we monitor traffic light changes in real time?Interviewer: Yes, notify a central monitor when lights change.
After gathering the details, we can summarize the key system requirements.