Creational design patterns are used to manage the objects as they are instantiated (created). In Java, there are two basic creation patterns. When we create classes, we use inheritance. When creating objects, we can assign the creation task to other objects.
The purposes of creational design patterns are as follows:
- Separate object creation from the system
- Support reliance on object creation vice inheritance
- Encapsulate information regarding which classes are used by a system
- Protect object creation details
The six creational design patterns presented in this chapter can be grouped into two subcategories—those that focus on classes and those that focus on objects. The following table details these subcategories:
Object Scope | Class Scope |
Abstract factory pattern | Factory pattern |
Builder pattern | Simple factory pattern |
Prototype... |