This course takes a practical, hands-on approach to teaching design patterns.
Over the next seven modules you will be asked to
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.
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.