An overview of the Factory Method

The Factory pattern is one of those patterns whose name is a good indication of its core purpose. There's a robust real-world correlation that can help us visualize its intent – imagine yourself ordering a new car at a dealership. During this process, does the dealer inform you of the manufacturing process of your new vehicle? The answer is probably no; usually, the dealer sends your order to the factory, and then they ship the requested final product back to you.

In other words, as the consumer of a product, you should focus on ordering and receiving, not manufacturing and distributing. And that's the primary goal of the Factory pattern; it simplifies the order process of specific types of objects by providing ...

Get Hands-On Game Development Patterns with Unity 2019 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.