Factory Pattern
Using a function or method to create and return objects, encapsulating the object-creation logic away from the calling code.
The Factory pattern centers on using a dedicated function (a 'factory function' or a static factory method) to construct and return objects, rather than having calling code invoke a constructor directly with new. The core benefit is decoupling *what kind* of object gets created from the calling code that needs one, which becomes especially valuable when object creation involves conditional logic, configuration, or should be swappable/testable independently from the code consuming the created objects.
A factory function is like ordering a 'sandwich' from a specific sandwich-shop counter rather than personally choosing and assembling every individual ingredient yourself — you describe roughly what you want, and the counter (factory) decides internally exactly how to build the specific item, handing you a finished product without you needing to know or care about its internal assembly steps.