Strategy pattern
E679865
The Strategy pattern is a behavioral design pattern that enables selecting an algorithm’s implementation at runtime by encapsulating each algorithm in a separate interchangeable class.
All labels observed (1)
| Label | Occurrences |
|---|---|
| Strategy pattern canonical | 3 |
How this entity was disambiguated
This entity first appeared as the object of triple T7665084 — resolving that mention is where its identity was fixed. The disambiguator weighed these candidate entities and picked the highlighted one (or “None”, minting a new entity). This is how homonymy is resolved: the same surface form can point to different entities.
Target entity: Strategy pattern Context triple: [Factory Method, relatedTo, Strategy pattern]
-
A.
Template Method
Template Method is a behavioral design pattern that defines the skeleton of an algorithm in a base class while allowing subclasses to override specific steps without changing the algorithm’s overall structure.
-
B.
Chain of Responsibility
Chain of Responsibility is a behavioral design pattern that decouples senders and receivers by passing a request along a chain of potential handlers until one of them processes it.
-
C.
Factory Method
Factory Method is a creational design pattern that defines an interface for creating objects while allowing subclasses to decide which concrete classes to instantiate, promoting loose coupling and extensibility.
-
D.
Design Patterns: Elements of Reusable Object-Oriented Software
Design Patterns: Elements of Reusable Object-Oriented Software is a seminal software engineering book by the "Gang of Four" that catalogues foundational object-oriented design patterns widely used in software development.
-
E.
Abstract Factory
Abstract Factory is a creational design pattern that provides an interface for creating families of related or dependent objects without specifying their concrete classes.
- F. None of above. chosen
- G. Unsure - the case is ambiguous/there is not enough information to decide.
Target entity: Strategy pattern Target entity description: The Strategy pattern is a behavioral design pattern that enables selecting an algorithm’s implementation at runtime by encapsulating each algorithm in a separate interchangeable class.
-
A.
Template Method
Template Method is a behavioral design pattern that defines the skeleton of an algorithm in a base class while allowing subclasses to override specific steps without changing the algorithm’s overall structure.
-
B.
Chain of Responsibility
Chain of Responsibility is a behavioral design pattern that decouples senders and receivers by passing a request along a chain of potential handlers until one of them processes it.
-
C.
Factory Method
Factory Method is a creational design pattern that defines an interface for creating objects while allowing subclasses to decide which concrete classes to instantiate, promoting loose coupling and extensibility.
-
D.
Design Patterns: Elements of Reusable Object-Oriented Software
Design Patterns: Elements of Reusable Object-Oriented Software is a seminal software engineering book by the "Gang of Four" that catalogues foundational object-oriented design patterns widely used in software development.
-
E.
Abstract Factory
Abstract Factory is a creational design pattern that provides an interface for creating families of related or dependent objects without specifying their concrete classes.
- F. None of above. chosen
Statements (47)
| Predicate | Object |
|---|---|
| instanceOf |
behavioral design pattern
ⓘ
software design pattern ⓘ |
| alternativeName | Policy pattern NERFINISHED ⓘ |
| applicableWhen |
a class defines many behaviors using conditional statements
ⓘ
algorithms contain data that clients should not know about ⓘ behavior should be selected or changed at runtime ⓘ different variants of an algorithm are needed ⓘ many related classes differ only in their behavior ⓘ |
| belongsTo | Gang of Four design patterns NERFINISHED ⓘ |
| category | behavioral pattern in object-oriented design ⓘ |
| consequence |
allows reuse of algorithms across different contexts
ⓘ
eliminates large conditional statements ⓘ enables dynamic switching of algorithms ⓘ increases number of objects and classes ⓘ makes algorithms easier to test in isolation ⓘ |
| defines | family of interchangeable behaviors ⓘ |
| definesRole |
ConcreteStrategy implements the Strategy interface
ⓘ
Context selects and uses a Strategy ⓘ Strategy declares an interface common to all supported algorithms ⓘ |
| describedIn | Design Patterns: Elements of Reusable Object-Oriented Software NERFINISHED ⓘ |
| documentedBy |
Erich Gamma
NERFINISHED
ⓘ
John Vlissides NERFINISHED ⓘ Ralph Johnson NERFINISHED ⓘ Richard Helm NERFINISHED ⓘ |
| enables | plug-and-play replacement of algorithms ⓘ |
| encapsulates | algorithm ⓘ |
| firstPublishedYear | 1994 ⓘ |
| hasIntent |
define a family of algorithms, encapsulate each one, and make them interchangeable
ⓘ
let the algorithm vary independently from clients that use it ⓘ |
| involves |
ConcreteStrategy
ⓘ
Context ⓘ Strategy interface ⓘ |
| promotes |
composition over inheritance
ⓘ
open-closed principle ⓘ single responsibility principle ⓘ |
| reduces | conditional logic for algorithm selection ⓘ |
| relatedTo |
Decorator pattern
NERFINISHED
ⓘ
State pattern NERFINISHED ⓘ Template Method pattern NERFINISHED ⓘ |
| separates | algorithm implementation from its usage ⓘ |
| supports |
runtime selection of algorithm
ⓘ
unit testing of algorithms independently of context ⓘ |
| typicalImplementationLanguage | object-oriented programming languages ⓘ |
| usedFor |
compression algorithm selection
ⓘ
payment method selection in e-commerce ⓘ routing or pathfinding strategy selection ⓘ sorting algorithm selection ⓘ |
How these facts were elicited
The pipeline generated the facts above by prompting gpt-5.1 with this entity's name + description and the instruction below.
You are a knowledge base construction expert. Given a subject entity and a description of it, return factual statements that you know for the subject as a JSON list of dictionaries(triples), where keys must be "subject", "predicate" and "object". The number of facts may be very high, between 25 to 50 or more, for very popular subjects. For less popular subjects, the number of facts can be very low, like 5 or 10. # Requirements - If you don't know the subject at all, return an empty list. - If the subject is not a named entity, return an empty list. - Include at least one triple where predicate is "instanceOf". - Do not get too wordy. - Separate several objects into multiple triples with one object.
Subject: Strategy pattern Description of subject: The Strategy pattern is a behavioral design pattern that enables selecting an algorithm’s implementation at runtime by encapsulating each algorithm in a separate interchangeable class.
Referenced by (3)
Full triples — surface form annotated when it differs from this entity's canonical label.