1/21
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Polymorphism (GRASP)
The Polymorphism pattern recommends assigning varying behavior to different subclasses or implementations through polymorphism instead of using conditional logic based on object type.
Behavioral Variation
Behavioral variation is the existence of multiple implementations of the same responsibility, with each implementation providing behavior appropriate to its type.
Type-Specific Behavior
Type-specific behavior is behavior whose implementation depends on the concrete type of an object while sharing a common interface or abstraction.
Common Interface
A common interface defines a shared contract that allows different implementations to be used interchangeably through polymorphism.
Dynamic Dispatch
Dynamic dispatch is the runtime process of selecting the appropriate implementation of a polymorphic operation based on an object's actual type.
Conditional Elimination
Conditional elimination is the replacement of large conditional statements with polymorphic behavior distributed across multiple classes.
Runtime Behavior Selection
Runtime behavior selection is the ability of a software system to choose the correct implementation while the program is executing rather than through explicit conditional logic.
Open Extension
Open extension is the ability to add new behaviors by creating new implementations without modifying existing client code.
Variation Point
A variation point is a location in a software design where multiple implementations of the same responsibility may exist.
Behavioral Substitution
Behavioral substitution is the replacement of one implementation with another while preserving the expected behavior defined by a common abstraction.
Type Checking
Type checking is the practice of selecting behavior by examining an object's concrete type, often using conditional statements.
Conditional Logic Smell
A conditional logic smell is the repeated use of large or growing conditional structures to perform type-specific behavior, indicating that polymorphism may provide a better design.
Replace Conditional with Polymorphism
Replace Conditional with Polymorphism is a refactoring technique that replaces type-based conditional logic with polymorphic implementations.
Behavioral Branching
Behavioral branching is the selection of different behaviors based on an object's characteristics or type.
Extensible Behavior
Extensible behavior is behavior that can be expanded through additional implementations without modifying existing code.
Polymorphic Responsibility
A polymorphic responsibility is a responsibility assigned to multiple implementations through a shared abstraction.
Behavior Delegation
Behavior delegation is the practice of allowing an object to perform behavior by invoking the appropriate polymorphic implementation rather than deciding which behavior to execute itself.
Strategy Candidate
A strategy candidate is a responsibility whose varying implementations suggest that the Strategy design pattern may be appropriate.
Variation Encapsulation
Variation encapsulation is the practice of placing differing behaviors inside separate implementations behind a common abstraction.
Polymorphism Heuristic
The Polymorphism heuristic recommends using polymorphism whenever behavior varies by type and conditional logic would otherwise grow over time.
Polymorphism vs Conditional Logic
Polymorphism distributes varying behavior across multiple implementations, while conditional logic centralizes behavioral decisions within a single component. Polymorphism generally improves extensibility when new variations are expected.
Polymorphism Mindset
The Polymorphism mindset is the habit of asking, "Can this varying behavior become separate implementations instead of another if or switch statement?" before adding new type-based logic.