Polski

Creational patterns

Factory Method

Subclasses decide which concrete object gets created; callers depend only on a shared interface.

Article

Factory Method – let the subclass decide what gets created

Factory Method separates the algorithm that uses an object from the decision about which exact object is created. A ticket booking example in C#, TypeScript, Java, Go and Python.

Related articles

Challenges

Around the topic

In this group: Creational patterns