Added More pattern UMLs

This commit is contained in:
John Webb
2014-07-31 14:13:53 -05:00
parent 3a35fa7ef6
commit de431c5126
33 changed files with 1508 additions and 2 deletions

View File

@@ -4,3 +4,7 @@
To create series of related or dependent objects without specifying their concrete classes.
Usually the created classes all implement the same interface. The client of the abstract factory does not care about how these objects are created, he just knows how they go together.
## UML Diagram
![Alt AbstractFactory UML Diagram](uml/uml.png)

View File

@@ -13,3 +13,7 @@ Note: Builders have often a fluent interface, see the mock builder of PHPUnit fo
## Examples
* PHPUnit: Mock Builder
## UML Diagram
![Alt Builder UML Diagram](uml/uml.png)

View File

@@ -9,3 +9,7 @@ For simple case, this abstract class could be just an interface
This pattern is a "real" Design Pattern because it achieves the "Dependency Inversion Principle" a.k.a the "D" in S.O.L.I.D principles.
It means the FactoryMethod class depends on abstractions, not concrete classes. This is the real trick compared to SimpleFactory or StaticFactory.
## UML Diagram
![Alt FactoryMethod UML Diagram](uml/uml.png)

View File

@@ -10,3 +10,7 @@ To have only a list of named instances that are used, like a singleton but with
* 2 DB Connectors, e.g. one for MySQL, the other for SQLite
* multiple Loggers (one for debug messages, one for errors)
## UML Diagram
![Alt Multiton UML Diagram](uml/uml.png)

View File

@@ -6,3 +6,7 @@ The **object pool pattern** is a software creational design pattern that uses a
Object pooling can offer a significant performance boost in situations where the cost of initializing a class instance is high, the rate of instantiation of a class is high, and the number of instances in use at any one time is low. The pooled object is obtained in predictable time when creation of the new objects (especially over network) may take variable time.
However these benefits are mostly true for objects that are expensive with respect to time, such as database connections, socket connections, threads and large graphic objects like fonts or bitmaps. In certain situations, simple object pooling (that hold no external resources, but only occupy memory) may not be efficient and could decrease performance.
## UML Diagram
![Alt Pool UML Diagram](uml/uml.png)

View File

@@ -7,3 +7,7 @@ To avoid the cost of creating objects the standard way (new Foo()) and instead c
## Examples
* Large amounts of data (e.g. create 1,000,000 rows in a database at once via a ORM)
## UML Diagram
![Alt Prototype UML Diagram](uml/uml.png)

View File

@@ -7,3 +7,7 @@ ConcreteFactory is a simple factory pattern.
It differs from the static factory because it is NOT static and as you know: static => global => evil!
Therefore, you can have multiple factories, differently parametrized, you can subclass it and you can mock-up it.
## UML Diagram
![Alt SimpleFactory UML Diagram](uml/uml.png)

View File

@@ -14,4 +14,8 @@ To have only one instance of this object in the application that will handle all
## Diagram
<img src="http://yuml.me/diagram/scruffy/class/[Singleton|-instance: Singleton|+getInstance(): Singleton;-__construct(): void;-__clone(): void;-__wakeup(): void]" >
<img src="http://yuml.me/diagram/scruffy/class/[Singleton|-instance: Singleton|+getInstance(): Singleton;-__construct(): void;-__clone(): void;-__wakeup(): void]" >
## UML Diagram
![Alt Singleton UML Diagram](uml/uml.png)

View File

@@ -9,3 +9,7 @@ method to create all types of objects it can create. It is usually named `factor
## Examples
* Zend Framework: `Zend_Cache_Backend` or `_Frontend` use a factory method create cache backends or frontends
## UML Diagram
![Alt StaticFactory UML Diagram](uml/uml.png)