Homework 2
SE
510 Principles and Applications of Software Design
Fall
2009
Creational Design Patterns
- Assume you are asked to design a software system that
allows car designers to design concept cars. For example, three wheel
cars, or front wheel drive or rear wheel drive cars, two doors or three
door or four door cars, a car train with multiple chassis and multiple
engines. The basic parts of a car include chassis, engine,
transmission, wheels , body, doors, and brake. Each of those
parts has a well-defined set of operations. for example, engine may be
set neutral , drive forward, reverse, stop. Car parts come in families
such as Ford, GM, Audi, etc. The car designer would not mix parts from
different families. This problem asks you to sketch a design using
Abstract Factory design pattern so that the car design tool can easily
change cars from one family to another. You are asked to draw the class
diagram(s) to show all the participants involved in the design pattern
and show enough Java-like code to demonstrate the collaboration.
- What if the car designer may mix up parts from different
families in the same car? Assume that the same parts, such as wheels,
must be identical. What design pattern would you used so that the
system can decide what family's products will be used for a part in a
given car..