Everything about Factory method pattern
Object-oriented software design pattern
In object-oriented programming, the factory method pattern is a design pattern that uses factory methods to deal with the problem of creating objects without having to specify their exact classes. Rather than by calling a constructor, this is accomplished by invoking a factory method to create an object. Factory methods can be specified in an interface and implemented by subclasses or implemented in a base class and optionally overridden by subclasses. It is one of the 23 classic design patterns described in the book Design Patterns and is subcategorized as a creational pattern. Wikipedia →
🧭 Start here: a 6-step reading path
- Read the overview: Factory method patternA 5-minute orientation
- Pick up a classic book: Objects first with JavaThe most-reprinted book on the subject
- Read the landmark paper: Is "Factory Method" really a pattern?Cited 1 times
- Go sideways: Prototype patternA closely related topic
- Go sideways: Abstract factory patternA closely related topic
📖 Definitions
Noun A creational design pattern that decouples the object creation by using an abstract method in the class.
🗂️ The subject at a glance
🏆 Landmark papers (most cited)
📚 Books worth reading
Objects first with JavaDavid J. Barnes, Michael Kolling · 2002
Clean CodeRobert C. Martin · 2008
Design PatternsErich Gamma, John Vlissides · 1995
The ascent of manJacob Bronowski · 1973
Investigations representing the departmentsUniversity of Chicago. · 1903
Language and Automata Theory and ApplicationsAdrian-Horia Dediu · 2012
Treaty Occupationay ToxicologySuelen Queiroz · 2010
The Conspirators HierarchyJohn Coleman · 1992
Ranked by number of editions on Open Library, a rough measure of how lasting a book is.
🔗 Related topics
- Prototype pattern The prototype pattern is a creational design pattern in software development. It is used when the types of objects to create is determined by a prototypical…
- Abstract factory pattern The abstract factory pattern in software engineering is a design pattern that provides a way to create families of related objects without imposing their…
- Abstract type In programming languages, an abstract type (also known as existential types) is a type in a nominative type system that cannot be instantiated directly;…
- Factory (object-oriented programming) In object-oriented programming, a factory is an object for creating other objects; formally, it is a function or method that returns objects of a varying…
- Decorator pattern In object-oriented programming, the decorator pattern is a design pattern that allows behavior to be added to an individual object dynamically, without…
- Template method pattern In object-oriented programming, the template method is one of the behavioral design patterns identified by Gamma et al. in the book Design Patterns. The…
- Virtual function In object-oriented programming such as is often used in C++ and Object Pascal, a virtual function or virtual method is an inheritable and overridable function…
- Fluent interface In software engineering, a fluent interface is an object-oriented API whose design relies extensively on method chaining. Its goal is to increase code…