Chapter 5. Factory Method Design Pattern
Women’s movements would form among the factory workers, a great mobilisation that destroyed the old models.
Design is the method of putting form and content together. Design, just as art, has multiple definitions; there is no single definition. Design can be art. Design can be aesthetics. Design is so simple, that’s why it is so complicated.
Create your own method. Don’t depend slavishly on mine. Make up something that will work for you! But keep breaking traditions, I beg you.
What Is the Factory Method Pattern?
As part of the creational category of design patterns, the Factory Method pattern is involved with creating something. In the case of the Factory Method, the something created is a product that is not tied to the class that creates it. Instead, in order to maintain loose coupling, the client makes the request through a factory. The factory then makes the requested product. Another way of thinking about it is that the Factory Method frees the product from the requestor. Figure 5-1 shows a class diagram of the Factory Method.

Figure 5-1. Implemented Factory Method class diagram
The Client class is implied. As you can see
in Figure 5-1, the
Client holds a reference to the Creator (factory interface) for requesting a graphic or text product. However, it does not instantiate the product it requests. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access