March 2002
Intermediate to advanced
496 pages
8h 51m
English
The intent of the FACTORY METHOD pattern is to define the interface for creating a new object so that a service provider decides which class to instantiate instead of clients. This pattern occurs in the Java class libraries and is common in application code.
You can also apply FACTORY METHOD when you want to introduce a parallel class hierarchy. This can help keep a set of classes from becoming bloated with many different aspects of behavior. FACTORY METHOD lets you connect parallel hierarchies by letting subclasses in one hierarchy determine which class to instantiate in the corresponding hierarchy.
Read now
Unlock full access