Factory method pattern

ID: factory-method-pattern

Declare a creation operation returning an abstract product interface and let concrete creators specialize how products are built. Clients call the creator interface rather than hard-coding construction of each concrete product. For example two regional manufacturers can implement build(carType): Car to select a concrete car and apply regional settings; optional wrappers can then be composed independently using the decorator pattern.

New to topics? Read the docs here!