Skip to content

Commit d6c38c9

Browse files
Tavernariochococo
authored andcommitted
Add better description
1 parent e2fa0a4 commit d6c38c9

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

‎Design-Patterns.playground.zip

121 Bytes
Binary file not shown.

‎Design-Patterns.playground/Pages/Creational.xcplaygroundpage/Contents.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ CurrencyFactory.currency(for: .uk)?.code ?? noCurrencyCode
196196
🔂 Monostate
197197
------------
198198

199-
The monostate pattern is an alternative to singleton, so in that case, monostate saves the state as static instead of the entire instance as a singleton. You can use a protocol to apply dependency inversion helping you on unit tests.
199+
The monostate pattern is another way to achieve singularity. It works through a completely different mechanism, it enforces the behavior of singularity without imposing structural constraints.
200+
So in that case, monostate saves the state as static instead of the entire instance as a singleton.
201+
[SINGLETON and MONOSTATE - Robert C. Martin](http://staff.cs.utu.fi/~jounsmed/doos_06/material/SingletonAndMonostate.pdf)
200202

201203
### Example:
202204
*/

‎README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,9 @@ CurrencyFactory.currency(for: .uk)?.code ?? noCurrencyCode
10071007
🔂 Monostate
10081008
------------
10091009

1010-
The monostate pattern is an alternative to singleton, so in that case, monostate saves the state as static instead of the entire instance as a singleton. You can use a protocol to apply dependency inversion helping you on unit tests.
1010+
The monostate pattern is another way to achieve singularity. It works through a completely different mechanism, it enforces the behavior of singularity without imposing structural constraints.
1011+
So in that case, monostate saves the state as static instead of the entire instance as a singleton.
1012+
[SINGLETON and MONOSTATE - Robert C. Martin](http://staff.cs.utu.fi/~jounsmed/doos_06/material/SingletonAndMonostate.pdf)
10111013

10121014
### Example:
10131015

‎source/creational/monostate.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
🔂 Monostate
33
------------
44

5-
The monostate pattern is an alternative to singleton, so in that case, monostate saves the state as static instead of the entire instance as a singleton. You can use a protocol to apply dependency inversion helping you on unit tests.
5+
The monostate pattern is another way to achieve singularity. It works through a completely different mechanism, it enforces the behavior of singularity without imposing structural constraints.
6+
So in that case, monostate saves the state as static instead of the entire instance as a singleton.
7+
[SINGLETON and MONOSTATE - Robert C. Martin](http://staff.cs.utu.fi/~jounsmed/doos_06/material/SingletonAndMonostate.pdf)
68

79
### Example:
810
*/

0 commit comments

Comments
 (0)