| Origin: |
Grand 98 |
| Reason: |
The logic to select which of many classes to instantiate is
common to all the classes.
|
| Synopsis: |
Encapsulate common and specialized logic to create objects
when common logic is used to select the class of the objects to create.
|
| Example: |
Create a database query object whose class depends on the
specific database been queried. The creation executes a common
piece of code that determines which class to instantiate.
|
| Solution: |
| Service |
The class that manages the creation of the objects that implement
ServiceImplIF.
The only visible class of the pattern.
|
|
| ServiceImplIF |
Interface or abstract class of the objects
created by Service.
|
QueryIF |
| ServiceImpli |
Concrete classes implementing ServiceImplIF. |
OracleQuery SybaseQuery |
| ServiceImplFactory |
The class that creates the objects that implement
ServiceImplIF.
|
|
|
| See also: |
The creational patterns
|