Design Patterns
Match the following architectural patterns to the descriptions of systems that use that pattern (solutions):
- creational
- create objects while hiding the creation logic, rather than instantiating
objects directly using the
new
operator, giving the program more flexibility in deciding which objects need to be created- abstract factory
- builder
- factory method
- prototype
- singleton
- structural
- class and object composition to add functionality
- adapter
- bridge
- filter
- composite
- decorator
- facade
- flyweight
- behavioral
- the ways in which classes or objects interact and distribute responsibilities
- chain of responsibility
- command
- interpreter
- iterator
- mediator
- memento
- observer
- state
- strategy
- template
- visitor
(Descriptions of categories adapted from Design Patterns (Gamma et al. 1994) and Tutorials Point’s Design Pattern - Overview)
-
Creates new object by cloning an existing object to improve performance
prototype
-
Hides the complexities of the system and provides the client access
facade
-
Represents a group of objects as a single object, typically represented in a tree format
composite
-
Class behavior or its algorithm can be changed at runtime
strategy
-
Used to reduce the number of objects created for both memory and speed advantages
flyweight
-
Changes the executing algorithm of an element class
visitor
-
Class behavior changes based on its state
state
-
Adds new functionality to an existing object without altering its structure
decorator
-
Creates an object but ensures there is only one
singleton
-
Creates a complex object that is composed of multiple other objects
builder
-
Evaluates a language grammar or expression
interpreter
-
Decouples an abstraction from its implementation so the two can vary independently
bridge
-
Also called the “criteria” pattern
filter
-
Used to restore the state of an object to a previous state
memento
-
Request is wrapped under an object as a command and passed to an invoker object
command
-
Access the elements of a collection object in sequential manner
iterator
-
Notifies dependent objects of changes to object
observer
-
Represents the functionality of another class
proxy
-
Handles communication between different classes
mediator
-
Creates objects but hides the details of how it is done
abstract factory
-
Creates a chain of receiver objects for a request
chain of responsibility
-
Connects otherwise incompatible interfaces
adapter