GofPatterns GofPatterns


Creational Patterns  «Prev  Next»
Lesson 8 Creational Classes-Coures Project
ObjectiveWrite Creational Classes for the Course Project

Write Creational Classes for the Course Project

As the final part of the creational classes for the course project, you will need a concrete implementation of the abstract VehicleFactory class. In this module, you will write about the simplest such class imaginable.
In the next module we will add one more subclass of VehicleFactory that also uses the Flyweight structural pattern and has some interesting implications for performance in systems with many objects.



Summary of Creational Patterns

  1. The Factory Pattern is used to choose and return an instance of a class from a number of similar classes based on data you provide to the factory.
  2. The Abstract Factory Pattern is used to return one of several groups of classes. In some cases it actually returns a Factory for that group of classes.
  3. The Builder Pattern assembles a number of objects to make a new object, based on the data with which it is presented. Frequently, the choice of which way the objects are assembled is achieved using a Factory.
  4. The Prototype Pattern copies or clones an existing class rather than creating a new instance when creating new instances is more expensive.
  5. The Singleton Pattern is a pattern that insures there is one and only one instance of an object, and that it is possible to obtain global access to that one instance.

Course Project - Exercise

In this exercise, you will write creational classes for the course project.
Course Project - Exercise