You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CreationalPatterns/Singleton/README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -118,7 +118,7 @@ This double-checked locking approach solves the thread concurrency problems whil
118
118
119
119
## Relations with Other Patterns
120
120
121
-
***AbstractFactory*, **Builder**, **Prototype** - These patterns can be implemented using the Singleton pattern
121
+
***AbstractFactory**, **Builder**, **Prototype** - These patterns can be implemented using the Singleton pattern
122
122
***Flyweight** - There should be only one Singleton instance, whereas Flyweight class can have multiple instances with a different intrinsic state. Whatsmore, Singleton object can be mutable but Flyweight objects are immutable.
Copy file name to clipboardExpand all lines: StructuralPatterns/Adapter/README.md
+33-16Lines changed: 33 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -11,17 +11,42 @@
11
11
12
12
Write a `Adapter` class that adapts the new vendor interface into the one you're expecting. The adapter acts as the middleman by receiving requests from the client and converting them into requests that make sense on the vendor class.
13
13
14
-
## Benefits
14
+
## Common Structure
15
+
16
+
There are two variations, namely **Object Adapter** and **Class Adapter**.
17
+
18
+

19
+
20
+
* Target (Duck)
21
+
* defines the domain-specific interface that client uses.

177
+
***Bridge** has a structure similar to an object adapter, but Bridge has a different intent. It is meant to separate an interface from its implementation so that they can be variaed easily and independently. An adapter is meant to change the interface of an *existing* object.
154
178
155
-
* Target (Duck)
156
-
* defines the domain-specific interface that client uses.
* adapts the interface Adaptee to the Target interface.
159
-
* Adaptee (Turkey)
160
-
* defines an existing interface that needs adapting.
161
-
* Client
162
-
* collaborates with objects conforming to the Target interface.
179
+
***Decorator** enhances another object without changing its interface. A decorator is thus more transparent to the application than an adapter is. As a consequence, Decorator supports recursive composition, which isn't possible with pure adapters.
0 commit comments