notes for design patterns and rss feed
This commit is contained in:
@@ -6,8 +6,90 @@
|
||||
|
||||
*WIP*
|
||||
|
||||
* Design patterns. What are they?
|
||||
* Summary of the major patterns:
|
||||
|
||||
** The Strategy Pattern
|
||||
Strategy is a behavioral design pattern that lets you define a family of algorithms, put each of them into a separate class, and make their objects interchangeable.
|
||||
|
||||
[[./assets/design-patterns/structure-pattern.png]]
|
||||
|
||||
|
||||
|
||||
** Observer pattern
|
||||
Observer is a behavioral design pattern that lets you define a subscription mechanism to notify multiple objects about any events that happen to the object they’re observing.
|
||||
|
||||
[[./assets/design-patterns/observer-pattern.png]]
|
||||
|
||||
|
||||
** Decorator pattern
|
||||
|
||||
Decorator is a structural design pattern that lets you attach new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors.
|
||||
|
||||
The problem:
|
||||
|
||||
[[./assets/design-patterns/decorator-problem.png]]
|
||||
|
||||
[[./assets/design-patterns/decorator-pattern.png]]
|
||||
|
||||
|
||||
** Factory Pattern
|
||||
Factory Method is a creational design pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.
|
||||
|
||||
[[./assets/design-patterns/factory-pattern.png]]
|
||||
|
||||
|
||||
** Singleton Pattern
|
||||
Singleton is a creational design pattern that lets you ensure that a class has only one instance, while providing a global access point to this instance.
|
||||
|
||||
[[./assets/design-patterns/singleton-pattern.png]]
|
||||
|
||||
|
||||
** Command Pattern
|
||||
Command is a behavioral design pattern that turns a request into a stand-alone object that contains all information about the request. This transformation lets you pass requests as a method arguments, delay or queue a request’s execution, and support undoable operations.
|
||||
|
||||
[[./assets/design-patterns/command-pattern.png]]
|
||||
|
||||
|
||||
** Adapter Pattern
|
||||
Adapter is a structural design pattern that allows objects with incompatible interfaces to collaborate.
|
||||
|
||||
[[./assets/design-patterns/adapter-pattern.png]]
|
||||
|
||||
Another approach:
|
||||
|
||||
[[./assets/design-patterns/adapter-pattern-2.png]]
|
||||
|
||||
** Facade Pattern
|
||||
Facade is a structural design pattern that provides a simplified interface to a library, a framework, or any other complex set of classes.
|
||||
|
||||
[[./assets/design-patterns/facade-pattern.png]]
|
||||
|
||||
|
||||
** Template Method Pattern
|
||||
Template Method is a behavioral design pattern that defines the skeleton of an algorithm in the superclass but lets subclasses override specific steps of the algorithm without changing its structure.
|
||||
|
||||
[[./assets/design-patterns/template-method-pattern.png]]
|
||||
|
||||
** Iterator and Composite Pattern
|
||||
Iterator is a behavioral design pattern that lets you traverse elements of a collection without exposing its underlying representation (list, stack, tree, etc.).
|
||||
|
||||
[[./assets/design-patterns/iterator-pattern.png]]
|
||||
|
||||
Composite is a structural design pattern that lets you compose objects into tree structures and then work with these structures as if they were individual objects.
|
||||
|
||||
[[./assets/design-patterns/composite-pattern.png]]
|
||||
|
||||
** State Pattern
|
||||
State is a behavioral design pattern that lets an object alter its behavior when its internal state changes. It appears as if the object changed its class.
|
||||
|
||||
[[./assets/design-patterns/state-pattern.png]]
|
||||
|
||||
** Proxy Pattern
|
||||
Proxy is a structural design pattern that lets you provide a substitute or placeholder for another object. A proxy controls access to the original object, allowing you to perform something either before or after the request gets through to the original object.
|
||||
|
||||
[[./assets/design-patterns/proxy-pattern.png]]
|
||||
|
||||
* Design patterns. What are they?
|
||||
|
||||
They are reusable solutions to common problems in software design. They help to make code more flexible, maintainable, and scalable.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user