Desktop Application

Traffic Intersection Simulation (Observer Pattern)

A C# Windows Forms simulation of a traffic intersection: vehicles subscribe to a traffic light and are notified of each change through the Observer design pattern.

Illustration of the Observer pattern: a traffic light notifying its subscribed vehicles (not a screenshot)
Category
Desktop Application
Period
2025
Stack
C#, C# Windows Forms, Object-Oriented Programming
Source
—
Overview

About the project

This Windows Forms application simulates a traffic intersection to put the Observer design pattern into practice. The traffic light is the subject: it keeps a list of subscribed vehicles and notifies all of them each time it switches between red and green.

Cars, motorcycles and bicycles (Voiture, Moto, Velo) inherit from a common Vehicule base class, so the traffic light works with any vehicle type. From the interface, the user can subscribe or unsubscribe individual vehicles and immediately see which ones react to the next change.

Main features

What it does

  • Traffic light with red and green states
  • Subscription and unsubscription of vehicles from the interface
  • Notification of every subscribed vehicle when the light changes
  • Vehicle hierarchy: Voiture, Moto and Velo inherit from Vehicule
  • Interface updated after each change
Development challenges

Problems to solve

  1. Managing subscriptions at runtime: adding and removing vehicles from the traffic light's observers without affecting the others.
  2. Keeping the traffic light independent of concrete vehicle classes by notifying them through the shared Vehicule base class.
  3. Keeping the interface in sync with the model after every state or subscription change.
Open to internships, apprenticeships & junior roles

Internship, apprenticeship or junior role? Let's talk.

I'm looking for an internship, an apprenticeship or a junior developer position, and I'm also open to selected freelance projects. Feel free to get in touch.