Skip to content

Commit

Permalink
+generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Oktawian Chojnacki committed Nov 1, 2014
1 parent 8f1f6ef commit 4a46d1c
Show file tree
Hide file tree
Showing 22 changed files with 82 additions and 8 deletions.
Binary file modified Design-Patterns.playground.zip
Binary file not shown.
7 changes: 4 additions & 3 deletions Design-Patterns.playground/Documentation/section-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ <h2 id="table-of-contents">Table of Contents</h2>
<ul>
<li><a href="#behavioral">Behavioral</a></li>
<li><a href="#creational">Creational</a></li>
<li><a href="#structural">Structural</a></li>
<li><a href="#structural">Structural</a><h1 id="behavioral">Behavioral</h1>
</li>
</ul>
<h1 id="behavioral">Behavioral</h1>
<blockquote>
<p>In software engineering, behavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication.</p>
<p><strong>Source:</strong> <a href="http://en.wikipedia.org/wiki/Behavioral_pattern">wikipedia.org</a></p>
</blockquote>
<h2 id="-chain-of-responsibility">🐝 Chain Of Responsibility</h2>
<p><strong>Source:</strong></p>
<p>The chain of responsibility pattern is used to process varied requests, each of which may be dealt with by a different handler.</p>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
3 changes: 3 additions & 0 deletions Design-Patterns.playground/Documentation/section-13.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<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>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
3 changes: 3 additions & 0 deletions Design-Patterns.playground/Documentation/section-17.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<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>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
2 changes: 2 additions & 0 deletions Design-Patterns.playground/Documentation/section-21.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<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>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
2 changes: 2 additions & 0 deletions Design-Patterns.playground/Documentation/section-25.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<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>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
3 changes: 3 additions & 0 deletions Design-Patterns.playground/Documentation/section-29.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ <h1 id="creational">Creational</h1>
<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>
</div>
Expand Down
3 changes: 3 additions & 0 deletions Design-Patterns.playground/Documentation/section-33.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<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>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
2 changes: 2 additions & 0 deletions Design-Patterns.playground/Documentation/section-39.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<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>

</section>
</div>
Expand Down
3 changes: 3 additions & 0 deletions Design-Patterns.playground/Documentation/section-43.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<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>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
3 changes: 3 additions & 0 deletions Design-Patterns.playground/Documentation/section-47.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<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>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
2 changes: 2 additions & 0 deletions Design-Patterns.playground/Documentation/section-5.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<div class="content-wrapper">
<section class="section">
<h2 id="-command">👫 Command</h2>
<p>The command pattern is used to express a request, including the call to be made and all of its required parameters, in a command object. The command may then be executed immediately or held for later use.</p>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
2 changes: 2 additions & 0 deletions Design-Patterns.playground/Documentation/section-51.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ <h1 id="structural">Structural</h1>
<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>
</div>
Expand Down
2 changes: 2 additions & 0 deletions Design-Patterns.playground/Documentation/section-55.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<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>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
2 changes: 2 additions & 0 deletions Design-Patterns.playground/Documentation/section-59.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<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>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
3 changes: 3 additions & 0 deletions Design-Patterns.playground/Documentation/section-63.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<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>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
2 changes: 2 additions & 0 deletions Design-Patterns.playground/Documentation/section-67.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<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>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
4 changes: 3 additions & 1 deletion Design-Patterns.playground/Documentation/section-71.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
<div class="content-wrapper">
<section class="section">
<h2 id="-protection-proxy">☔ Protection Proxy</h2>
<p><strong>Source:</strong></p>
<p>The proxy pattern is used to provide a surrogate or placeholder object, which references an underlying object.
Protection proxy is restricting access.</p>
<p><strong>Example:</strong></p>

</section>
</div>
Expand Down
4 changes: 3 additions & 1 deletion Design-Patterns.playground/Documentation/section-75.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
<div class="content-wrapper">
<section class="section">
<h2 id="-virtual-proxy">🍬 Virtual Proxy</h2>
<p><strong>Source:</strong></p>
<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
1 change: 1 addition & 0 deletions Design-Patterns.playground/Documentation/section-79.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<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>
Expand Down
6 changes: 6 additions & 0 deletions Design-Patterns.playground/Documentation/section-9.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
<div class="content-wrapper">
<section class="section">
<h2 id="-iterator">🚧 Iterator</h2>
<p>The iterator pattern is used to provide a standard interface for traversing a collection of items in an aggregate object without the need to understand its underlying structure.</p>
<p><em>No example, yet.</em></p>
<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>
</div>
Expand Down
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ A short cheat-sheet with Xcode 6 Playground ([Design-Patterns.playground.zip](ht
* [Behavioral](#behavioral)
* [Creational](#creational)
* [Structural](#structural)

#Behavioral

>In software engineering, behavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication.
Expand Down Expand Up @@ -741,6 +740,11 @@ tuple.y
tuple.z
```
##🌉 Bridge

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.

**Example:**

```swift
protocol Switch {
var appliance: Appliance {get set}
Expand Down Expand Up @@ -787,6 +791,10 @@ fancyVacuumCleanerRemoteControl.turnOn()

##🌿 Composite

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.

**Example:**

```swift
/**
* Component
Expand Down Expand Up @@ -834,6 +842,11 @@ whiteboard.draw("Red")
```
##🍧 Decorator

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.

**Example:**

```swift
protocol Coffee {
func getCost() -> Double
Expand Down Expand Up @@ -908,6 +921,10 @@ println("Cost : \(someCoffee.getCost()); Ingredients: \(someCoffee.getIngredient

##🎁 Façade

The facade pattern is used to define a simplified interface to a more complex subsystem.

**Example:**

```swift
class Eternal {

Expand All @@ -932,7 +949,11 @@ Eternal.objectForKey("Bishop")
```
##☔ Protection Proxy

**Source:**
The proxy pattern is used to provide a surrogate or placeholder object, which references an underlying object.
Protection proxy is restricting access.

**Example:**

```swift
protocol DoorOperator {
func openDoors(doors: String) -> String
Expand Down Expand Up @@ -982,7 +1003,11 @@ computer.openDoors(doors)

##🍬 Virtual Proxy

**Source:**
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.

**Example:**

```swift
protocol HEVSuitMedicalAid {
func administerMorphine() -> String
Expand Down

0 comments on commit 4a46d1c

Please sign in to comment.