January 2025
Intermediate to advanced
304 pages
8h 28m
English
In this chapter, we will explore the Factory pattern, a creational design pattern that allows us to establish a default interface in a superclass, which will allow it to create new objects. Subclasses can then change the type or the way these objects are created, allowing us to use a common interface to create a range of different objects.
By using the Factory pattern, we can decouple an object’s creational responsibility and delegate it to the factory object, which will take care of all the procedures necessary to create this object in the application. Generally speaking, the Factory pattern can create any type of object. Keep in mind our definition of an object: the concrete instance of a class. ...
Read now
Unlock full access