Creational design patterns are design patterns that deal with object creation mechanisms in a safe and efficient manner and decouple clients from implementation specifics. With these patterns, the code using an object need not know details about how the object is created, or even the specific type of object, as long as the object adheres to the interface expected.
Creational design patterns
Factory method
A factory is an object that is used to create other objects. We looked at the preceding reservation interface. Essentially, it is an association between an item for sale and a user who bought it, along with some metadata such as dates and so on, and there will be multiple types of reservation. So, how does the client code...