The factory design pattern is used when we have a superclass with multiple sub-classes and based on input, we need to return one of the sub-class. This pattern takes out the responsibility of the instantiation of a class from the client program to the factory class.
Use different variants of an algorithm within an object and be able to switch from one algorithm to another during runtime.
Encapsulates commands (method calls) in objects allowing us to issue requests without knowing the requested operation or the requesting object.
The builder pattern is a design pattern designed to provide a flexible solution to various object creation problems in object-oriented programming. For eg creating a Student object with some members as required and some are optional.
Add characteristics to an object at runtime. Many factors can affect the object’s characteristics.