Skip to content

Commit de431c5

Browse files
author
John Webb
committed
Added More pattern UMLs
1 parent 3a35fa7 commit de431c5

File tree

33 files changed

+1508
-2
lines changed

33 files changed

+1508
-2
lines changed

Behavioral/ChainOfResponsibilities/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ To build a chain of objects to handle a call. If one object cannot handle a call
1010
* a Spam filter
1111
* Caching: first object is an instance of e.g. a Memcached Interface, if that "misses" it delegates the call to the database interface
1212
* Yii Framework: CFilterChain is a chain of controller action filters. the executing point is passed from one filter to the next along the chain, and only if all filters say "yes", the action can be invoked at last.
13+
14+
## UML Diagram
15+
16+
![Alt ChainOfResponsibility UML Diagram](uml/uml.png)

Behavioral/Command/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ Command can also be aggregated to combine more complex commands with minimum cop
1515
* A text editor : all events are Command which can be undone, stacked and saved.
1616
* Symfony2: SF2 Commands that can be run from the CLI are built with just the Command pattern in mind
1717
* big CLI tools use subcommands to distribute various tasks and pack them in "modules", each of these can be implemented with the Command pattern (e.g. vagrant)
18+
19+
## UML Diagram
20+
21+
![Alt Command UML Diagram](uml/uml.png)

Behavioral/Iterator/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ To make an object iterable and to make it appear like a collection of objects.
1111
## Note
1212

1313
Standard PHP Library (SPL) defines an interface Iterator which is best suited for this! Often you would want to implement the Countable interface too, to allow `count($object)` on your iterable object
14+
15+
## UML Diagram
16+
17+
![Alt Iterator UML Diagram](uml/uml.png)

Behavioral/Mediator/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ like a controller (but not in the sense of the MVC).
99
All components (called Colleague) are only coupled to the MediatorInterface and
1010
it is a good thing because in OOP, one good friend is better than many. This
1111
is the key-feature of this pattern.
12+
13+
## UML Diagram
14+
15+
![Alt Mediator UML Diagram](uml/uml.png)

Behavioral/Memento/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ When using this pattern, care should be taken if the originator may change other
1616

1717
* The seed of a pseudorandom number generator
1818
* The state in a finite state machine
19+
20+
## UML Diagram
21+
22+
![Alt Momento UML Diagram](uml/uml.png)

Behavioral/NullObject/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ a statement like `if (!is_null($obj)) { $obj->callSomething(); }` anymore.
1818
* Symfony2: null output in Symfony/Console
1919
* null handler in a Chain of Responsibilities pattern
2020
* null command in a Command pattern
21+
22+
## UML Diagram
23+
24+
![Alt NullObject UML Diagram](uml/uml.png)

Behavioral/Observer/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ To implement a publish/subscribe behaviour to an object, whenever a "Subject" ob
1111

1212
## Note
1313

14-
PHP already defines two interfaces that can help to implement this pattern: SplObserver and SplSubject.
14+
PHP already defines two interfaces that can help to implement this pattern: SplObserver and SplSubject.
15+
16+
## UML Diagram
17+
18+
![Alt Observer UML Diagram](uml/uml.png)

Behavioral/Specification/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55
Builds a clear specification of business rules, where objects can be checked against. The composite specification class has
66
one method called `isSatisfiedBy` that returns either true or false depending on whether the given object satisfies the specification.
77

8+
## UML Diagram
9+
10+
![Alt Specification UML Diagram](uml/uml.png)

Behavioral/State/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
## Purpose
44

55
Encapsulate varying behavior for the same routine based on an object's state. This can be a cleaner way for an object to change its behavior at runtime without resorting to large monolithic conditional statements.
6+
7+
## UML Diagram
8+
9+
![Alt State UML Diagram](uml/uml.png)

Behavioral/Strategy/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ To separate strategies and to enable fast switching between them. Also this patt
1414

1515
* sorting a list of objects, one strategy by date, the other by id
1616
* simplify unit testing: e.g. switching between file and in-memory storage
17+
18+
## UML Diagram
19+
20+
![Alt Strategy UML Diagram](uml/uml.png)

0 commit comments

Comments
 (0)