|Lesson 8|| Creational Classes-Coures Project |
|Objective||Write 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
- 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.
- 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.
- 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.
- The Prototype Pattern copies or clones an existing class rather than creating a new instance when creating new instances is more expensive.
- 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