@@ -17,53 +17,89 @@ A tiny retro action RPG implementation made applying Software Design Patterns to
17
17
## 🔊 Behavioral Patterns
18
18
Define a concrete communication scheme between objects.
19
19
* ### Bytecode
20
+ Give a behavior the flexibility of data by encoding it as instructions for a virtual machine.
20
21
* ### Chain of Responsibility
22
+ Delegates commands to a chain of processing objects.
21
23
* ### Command
24
+ Creates objects that encapsulate actions and parameters.
22
25
* ### Interpreter
26
+ Implements a specialized language.
23
27
* ### Iterator
28
+ Accesses the elements of an object sequentially without exposing its underlying representation.
24
29
* ### Mediator
30
+ Allows loose coupling between classes by being the only class that has detailed knowledge of their methods.
25
31
* ### Memento
32
+ Provides the ability to restore an object to its previous state (undo).
26
33
* ### Observer
34
+ Is a publish/subscribe pattern, which allows a number of observer objects to see an event.
27
35
* ### State
36
+ Allows an object to alter its behavior when its internal state changes.
28
37
* ### Strategy
38
+ Allows one of a family of algorithms to be selected on-the-fly at runtime.
29
39
* ### Subclass Sandbox
40
+ Defines the behavior in a subclass using a set of operations provided by its base class.
30
41
* ### Template Method
42
+ Defines the skeleton of an algorithm as an abstract class, allowing its subclasses to provide concrete behavior.
31
43
* ### Type Object
44
+ Allows a flexible creation of new “classes” by creating a single class, each instance of which represents a different type of object.
32
45
* ### Visitor
46
+ Separates an algorithm from an object structure by moving the hierarchy of methods into one object.
33
47
34
48
## 🐣 Creational Patterns
35
49
Create objects, rather than instantiating them directly.
36
50
* ### Abstract Factory
51
+ Groups object factories that have a common theme.
37
52
* ### Builder
53
+ Constructs complex objects by separating construction and representation.
38
54
* ### Factory Method
55
+ Creates objects without specifying the exact class to create.
39
56
* ### Prototype
57
+ Creates objects by cloning an existing object.
40
58
* ### Singleton
59
+ Restricts object creation for a class to only one instance.
41
60
42
61
## ✂️ Decoupling Patterns
43
62
Split dependencies to ensure that changing a piece of code doesn't require changing another one.
44
63
* ### Component
64
+ Allows a single entity to span multiple domains without coupling the domains to each other.
45
65
* ### Event Queue
66
+ Decouples when an event is sent and when it is executed.
46
67
* ### Service Locator
68
+ Provides global access to services without being attached to the concrete class.
47
69
48
70
## 🛠️ Optimization Patterns
49
71
Speed up the game by pushing the hardware to the furthest.
50
72
* ### Data Locality
73
+ Accelerates memory access by arranging data to take advantage of CPU caching.
51
74
* ### Dirty Flag
75
+ Avoids unnecessary work by deferring it until the result is needed.
52
76
* ### Object Pool
77
+ Allows the recycling of objects and optimizes performance and memory.
53
78
* ### Spatial Partition
79
+ Locates objects efficiently by storing them in a data structure organized by their positions.
54
80
55
81
## ⏰ Sequencing Patterns
56
82
Invent time and craft the gears that drive the game's great clock.
57
83
* ### Double Buffer
84
+ Causes a series of sequential operations to appear instantaneous or simultaneous.
58
85
* ### Game Loop
86
+ Decouples the progression of game time from user input and processor speed.
59
87
* ### Update Method
88
+ Simulates a collection of independent objects by telling each to process one frame of behavior at a time.
60
89
61
90
## 🧬 Structural Patterns
62
91
Use inheritance to compose interfaces and define ways to compose objects to obtain new functionality.
63
92
* ### Adapter
93
+ Allows classes with incompatible interfaces to work together by wrapping its own interface around that of an already existing class.
64
94
* ### Bridge
95
+ Decouples an abstraction from its implementation so that the two can vary independently.
65
96
* ### Composite
97
+ Composes zero-or-more similar objects so that they can be manipulated as one object.
66
98
* ### Decorator
99
+ Dynamically adds/overrides behavior in an existing method of an object.
67
100
* ### Facade
101
+ Provides a simplified interface to a large body of code.
68
102
* ### Flyweight
103
+ Reduces the cost of creating and manipulating a large number of similar objects.
69
104
* ### Proxy
105
+ Provides a placeholder for another object to control access, reduce cost, and reduce complexity.
0 commit comments