Patterns Flashcards
Factory
Creational pattern.
Creates objects based on some input data.
Abstract Factory
Creational pattern.
Creates factories based on some input data.
Singleton
Creational pattern.
Object with a single instance, available via static method.
Builder
Creational pattern. Builds complex item in steps with builder class and helper methods.
Prototype
Creational pattern.
Object is created by cloning existing object (to avoid requesting data if it is costly).
Adapter / Wrapper
Structural pattern.
Object is put inside other object and its methods mapped to the required methods.
Bridge
Structural pattern.
Multiple classes implement same interface, acting thus as bridge to different realisations.
Filter (Criteria)
Structural pattern.
Object that filters some data and can be combined with objects which filter the same type of data.
Composite
Structural pattern.
Used when we need to treat heirarchy of objects as one object.
Decorator
Structural pattern.
Allows for the dynamic wrapping of objects in order to modify their existing responsibilities and behaviors.
Facade
Structural pattern.
Hides complexity of some code behind simplified interface.
Flyweight
Structural pattern.
Reusing existing objects as much as possible to lower memory footprint.
Proxy
Structural pattern.
Controls and manages access to some other object.
Chain of responsibility
Behavioral pattern.
Gives more than one object an opportunity to handle a request by linking receiving objects together.
Command
Behavioral pattern.
Command is sent in a form of object to the other object which can execute it.