GofPatterns Gofpatterns  





Design Patterns  «Prev  Next»
Lesson 4 Design Patterns Course project
Objective General specifications for the "Gang of Four" course project.
This course takes a practical, hands-on approach to teaching design patterns.
Over the next seven modules you will be asked to
  1. analyze,
  2. design, and
  3. write
a program that simulates traffic flow at an intersection.
The intersection, shown below, is perhaps the simplest imaginable. Cars move in one of two directions (and drive on the right hand side of the street).
Traffic flows through green lights. Pedestrians cross only at the crosswalk, on a Walk sign.
Traffic is stopped by a red light, pedestrians by a Don't Walk sign.
Image of traffic system
Image of traffic system

Design Patterns: Object-Oriented SoftwareDesign Patterns: Object-Oriented Software

We are only going to write the classes and objects that perform the simulation.
We are not going to design a graphical user interface in this course.
Interface design is a field in itself, and a topic for another course.
Proper object-oriented design separates the user interface from the data model so different interfaces can be applied to the same fundamental program.
There is more than one way to approach this task. Naturally enough, we will take an object-oriented approach that defines classes for the cars, the pedestrians, the traffic lights, and the roads.
Design patterns will be used to structure the relationships between the classes and objects in our simulation. How exactly you identify, define, and document these things is the subject of the rest of this course.

Course Project - Exercise
Before we can go further with the course project, we first have to identify the classes that make up the system.
Course Project - Exercise