Skip to content

Commit

Permalink
Added Mediator pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
delebedev committed Dec 2, 2014
1 parent b129da1 commit e72a449
Show file tree
Hide file tree
Showing 66 changed files with 777 additions and 574 deletions.
Binary file modified Design-Patterns.playground.zip
Binary file not shown.
3 changes: 0 additions & 3 deletions Design-Patterns.playground/Documentation/section-13.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
<section class="section">
<h2 id="-mediator">🚧 Mediator</h2>
<p>The mediator pattern is used to reduce coupling between classes that communicate with each other. Instead of classes communicating directly, and thus requiring knowledge of their implementation, the classes send messages via a mediator object.</p>
<p><em>No example, yet.</em></p>
<h2 id="-memento">💾 Memento</h2>
<p>The memento pattern is used to capture the current state of an object and store it in such a manner that it can be restored at a later time without breaking the rules of encapsulation.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
5 changes: 2 additions & 3 deletions Design-Patterns.playground/Documentation/section-17.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-observer">👓 Observer</h2>
<p>The observer pattern is used to allow an object to publish changes to its state.
Other objects subscribe to be immediately notified of any changes.</p>
<h2 id="-memento">💾 Memento</h2>
<p>The memento pattern is used to capture the current state of an object and store it in such a manner that it can be restored at a later time without breaking the rules of encapsulation.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
2 changes: 1 addition & 1 deletion Design-Patterns.playground/Documentation/section-19.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<body>
<div class="content-wrapper">
<section class="section">
<p><strong>Usage:</strong></p>
<p><strong><em>Usage:</em></strong></p>

</section>
</div>
Expand Down
6 changes: 3 additions & 3 deletions Design-Patterns.playground/Documentation/section-21.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-state">🐉 State</h2>
<p>The state pattern is used to alter the behaviour of an object as its internal state changes.
The pattern allows the class for an object to apparently change at run-time.</p>
<h2 id="-observer">👓 Observer</h2>
<p>The observer pattern is used to allow an object to publish changes to its state.
Other objects subscribe to be immediately notified of any changes.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
5 changes: 3 additions & 2 deletions Design-Patterns.playground/Documentation/section-25.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-strategy">💡 Strategy</h2>
<p>The strategy pattern is used to create an interchangeable family of algorithms from which the required process is chosen at run-time.</p>
<h2 id="-state">🐉 State</h2>
<p>The state pattern is used to alter the behaviour of an object as its internal state changes.
The pattern allows the class for an object to apparently change at run-time.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
4 changes: 2 additions & 2 deletions Design-Patterns.playground/Documentation/section-29.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-visitor">🏃 Visitor</h2>
<p>The visitor pattern is used to separate a relatively complex set of structured data classes from the functionality that may be performed upon the data that they hold.</p>
<h2 id="-strategy">💡 Strategy</h2>
<p>The strategy pattern is used to create an interchangeable family of algorithms from which the required process is chosen at run-time.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
10 changes: 2 additions & 8 deletions Design-Patterns.playground/Documentation/section-33.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@
<body>
<div class="content-wrapper">
<section class="section">
<h1 id="creational">Creational</h1>
<blockquote>
<p>In software engineering, creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling this object creation.</p>
<p><strong>Source:</strong> <a href="http://en.wikipedia.org/wiki/Creational_pattern">wikipedia.org</a></p>
</blockquote>
<h2 id="-abstract-factory">🌰 Abstract Factory</h2>
<p>The abstract factory pattern is used to provide a client with a set of related or dependant objects.
The &quot;family&quot; of objects created by the factory are determined at run-time.</p>
<h2 id="-visitor">🏃 Visitor</h2>
<p>The visitor pattern is used to separate a relatively complex set of structured data classes from the functionality that may be performed upon the data that they hold.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
11 changes: 8 additions & 3 deletions Design-Patterns.playground/Documentation/section-37.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-builder">👷 Builder</h2>
<p>The builder pattern is used to create complex objects with constituent parts that must be created in the same order or using a specific algorithm.
An external class controls the construction algorithm.</p>
<h1 id="creational">Creational</h1>
<blockquote>
<p>In software engineering, creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling this object creation.</p>
<p><strong>Source:</strong> <a href="http://en.wikipedia.org/wiki/Creational_pattern">wikipedia.org</a></p>
</blockquote>
<h2 id="-abstract-factory">🌰 Abstract Factory</h2>
<p>The abstract factory pattern is used to provide a client with a set of related or dependant objects.
The &quot;family&quot; of objects created by the factory are determined at run-time.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
5 changes: 4 additions & 1 deletion Design-Patterns.playground/Documentation/section-41.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
<body>
<div class="content-wrapper">
<section class="section">
<p>Shorter but oh-so-ugly alternative:</p>
<h2 id="-builder">👷 Builder</h2>
<p>The builder pattern is used to create complex objects with constituent parts that must be created in the same order or using a specific algorithm.
An external class controls the construction algorithm.</p>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
4 changes: 1 addition & 3 deletions Design-Patterns.playground/Documentation/section-43.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-factory-method">🏭 Factory Method</h2>
<p>The factory pattern is used to replace class constructors, abstracting the process of object generation so that the type of the object instantiated can be determined at run-time.</p>
<p><strong>Example:</strong></p>
<p><strong>Usage:</strong></p>

</section>
</div>
Expand Down
2 changes: 1 addition & 1 deletion Design-Patterns.playground/Documentation/section-45.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<body>
<div class="content-wrapper">
<section class="section">
<p><strong>Usage:</strong></p>
<p>Shorter but oh-so-ugly alternative:</p>

</section>
</div>
Expand Down
5 changes: 2 additions & 3 deletions Design-Patterns.playground/Documentation/section-47.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-prototype">🃏 Prototype</h2>
<p>The prototype pattern is used to instantiate a new object by copying all of the properties of an existing object, creating an independent clone.
This practise is particularly useful when the construction of a new object is inefficient.</p>
<h2 id="-factory-method">🏭 Factory Method</h2>
<p>The factory pattern is used to replace class constructors, abstracting the process of object generation so that the type of the object instantiated can be determined at run-time.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
6 changes: 3 additions & 3 deletions Design-Patterns.playground/Documentation/section-51.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-singleton">💍 Singleton</h2>
<p>The singleton pattern ensures that only one object of a particular class is ever created.
All further references to objects of the singleton class refer to the same underlying instance.</p>
<h2 id="-prototype">🃏 Prototype</h2>
<p>The prototype pattern is used to instantiate a new object by copying all of the properties of an existing object, creating an independent clone.
This practise is particularly useful when the construction of a new object is inefficient.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
10 changes: 3 additions & 7 deletions Design-Patterns.playground/Documentation/section-55.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@
<body>
<div class="content-wrapper">
<section class="section">
<h1 id="structural">Structural</h1>
<blockquote>
<p>In software engineering, structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships between entities.</p>
<p><strong>Source:</strong> <a href="http://en.wikipedia.org/wiki/Structural_pattern">wikipedia.org</a></p>
</blockquote>
<h2 id="-adapter">🔌 Adapter</h2>
<p>The adapter pattern is used to provide a link between two otherwise incompatible types by wrapping the &quot;adaptee&quot; with a class that supports the interface required by the client.</p>
<h2 id="-singleton">💍 Singleton</h2>
<p>The singleton pattern ensures that only one object of a particular class is ever created.
All further references to objects of the singleton class refer to the same underlying instance.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
9 changes: 7 additions & 2 deletions Design-Patterns.playground/Documentation/section-59.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-bridge">🌉 Bridge</h2>
<p>The bridge pattern is used to separate the abstract elements of a class from the implementation details, providing the means to replace the implementation details without modifying the abstraction.</p>
<h1 id="structural">Structural</h1>
<blockquote>
<p>In software engineering, structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships between entities.</p>
<p><strong>Source:</strong> <a href="http://en.wikipedia.org/wiki/Structural_pattern">wikipedia.org</a></p>
</blockquote>
<h2 id="-adapter">🔌 Adapter</h2>
<p>The adapter pattern is used to provide a link between two otherwise incompatible types by wrapping the &quot;adaptee&quot; with a class that supports the interface required by the client.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
2 changes: 1 addition & 1 deletion Design-Patterns.playground/Documentation/section-61.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<body>
<div class="content-wrapper">
<section class="section">
<p><strong>Usage</strong></p>
<p><strong>Usage:</strong></p>

</section>
</div>
Expand Down
4 changes: 2 additions & 2 deletions Design-Patterns.playground/Documentation/section-63.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-composite">🌿 Composite</h2>
<p>The composite pattern is used to create hierarchical, recursive tree structures of related objects where any element of the structure may be accessed and utilised in a standard manner.</p>
<h2 id="-bridge">🌉 Bridge</h2>
<p>The bridge pattern is used to separate the abstract elements of a class from the implementation details, providing the means to replace the implementation details without modifying the abstraction.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
2 changes: 1 addition & 1 deletion Design-Patterns.playground/Documentation/section-65.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<body>
<div class="content-wrapper">
<section class="section">
<p><strong>Usage:</strong></p>
<p><strong>Usage</strong></p>

</section>
</div>
Expand Down
5 changes: 2 additions & 3 deletions Design-Patterns.playground/Documentation/section-67.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-decorator">🍧 Decorator</h2>
<p>The decorator pattern is used to extend or alter the functionality of objects at run- time by wrapping them in an object of a decorator class.
This provides a flexible alternative to using inheritance to modify behaviour.</p>
<h2 id="-composite">🌿 Composite</h2>
<p>The composite pattern is used to create hierarchical, recursive tree structures of related objects where any element of the structure may be accessed and utilised in a standard manner.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
5 changes: 3 additions & 2 deletions Design-Patterns.playground/Documentation/section-71.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-fa-ade">🎁 Façade</h2>
<p>The facade pattern is used to define a simplified interface to a more complex subsystem.</p>
<h2 id="-decorator">🍧 Decorator</h2>
<p>The decorator pattern is used to extend or alter the functionality of objects at run- time by wrapping them in an object of a decorator class.
This provides a flexible alternative to using inheritance to modify behaviour.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
5 changes: 2 additions & 3 deletions Design-Patterns.playground/Documentation/section-75.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-protection-proxy">☔ Protection Proxy</h2>
<p>The proxy pattern is used to provide a surrogate or placeholder object, which references an underlying object.
Protection proxy is restricting access.</p>
<h2 id="-fa-ade">🎁 Façade</h2>
<p>The facade pattern is used to define a simplified interface to a more complex subsystem.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
4 changes: 2 additions & 2 deletions Design-Patterns.playground/Documentation/section-79.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<body>
<div class="content-wrapper">
<section class="section">
<h2 id="-virtual-proxy">🍬 Virtual Proxy</h2>
<h2 id="-protection-proxy">☔ Protection Proxy</h2>
<p>The proxy pattern is used to provide a surrogate or placeholder object, which references an underlying object.
Virtual proxy is used for loading object on demand.</p>
Protection proxy is restricting access.</p>
<p><strong>Example:</strong></p>

</section>
Expand Down
8 changes: 4 additions & 4 deletions Design-Patterns.playground/Documentation/section-83.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<body>
<div class="content-wrapper">
<section class="section">
<h1 id="info">Info</h1>
<p>🍺 Playground generated with: <a href="https://github.com/jas/playground">playground</a> by <a href="http://twitter.com/jasonsandmeyer">@jasonsandmeyer</a></p>
<p>📖 Descriptions from: <a href="http://www.blackwasp.co.uk/GangOfFour.aspx">Gang of Four Design Patterns Reference Sheet</a></p>
<p>🚀 How to generate playground (+zip) from this README: <a href="https://github.com/ochococo/Design-Patterns-In-Swift/blob/master/GENERATE.markdown">GENERATE.markdown</a></p>
<h2 id="-virtual-proxy">🍬 Virtual Proxy</h2>
<p>The proxy pattern is used to provide a surrogate or placeholder object, which references an underlying object.
Virtual proxy is used for loading object on demand.</p>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
19 changes: 19 additions & 0 deletions Design-Patterns.playground/Documentation/section-85.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Section 86</title>
<meta id="xcode-display" name="xcode-display" content="render">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div class="content-wrapper">
<section class="section">
<p><strong>Usage:</strong></p>

</section>
</div>
</body>
</html>
22 changes: 22 additions & 0 deletions Design-Patterns.playground/Documentation/section-87.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Section 88</title>
<meta id="xcode-display" name="xcode-display" content="render">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div class="content-wrapper">
<section class="section">
<h1 id="info">Info</h1>
<p>🍺 Playground generated with: <a href="https://github.com/jas/playground">playground</a> by <a href="http://twitter.com/jasonsandmeyer">@jasonsandmeyer</a></p>
<p>📖 Descriptions from: <a href="http://www.blackwasp.co.uk/GangOfFour.aspx">Gang of Four Design Patterns Reference Sheet</a></p>
<p>🚀 How to generate playground (+zip) from this README: <a href="https://github.com/ochococo/Design-Patterns-In-Swift/blob/master/GENERATE.markdown">GENERATE.markdown</a></p>

</section>
</div>
</body>
</html>
8 changes: 8 additions & 0 deletions Design-Patterns.playground/contents.xcplayground
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,13 @@
</code>
<documentation relative-path="section-83.html">
</documentation>
<code source-file-name="section-84.swift">
</code>
<documentation relative-path="section-85.html">
</documentation>
<code source-file-name="section-86.swift">
</code>
<documentation relative-path="section-87.html">
</documentation>
</sections>
</playground>
Loading

0 comments on commit e72a449

Please sign in to comment.