Skip to content

Latest commit

 

History

History
61 lines (52 loc) · 3.99 KB

File metadata and controls

61 lines (52 loc) · 3.99 KB

#Design Patterns in PHP I collect the best examples of design patterns in PHP. Every pattern have file index.php with examples and diagrams (draw in Dia). I think this is better than big description.

Creational

  • Factory Method Creates an instance of several derived classes
  • Abstract Factory Creates an instance of several families of classes
  • Singleton A class of which only a single instance can exist
  • Builder Separates object construction from its representation
  • Prototype Creates new objects by copying this prototype
  • Adapter Converts one interface to another so that it matches what the client is expecting
  • Bridge Separates an object’s interface from its implementation
  • Decorator Dynamically adds responsibility to the interface by wrapping the original code
  • Facade Provides a simplified interface
  • Proxy Provide a surrogate or placeholder for another object to control access to it
  • Composite Compose objects into tree structures to represent part-whole hierarchies
  • Flyweight Use sharing to support large numbers of similar objects efficiently

Behavioral

  • Interpreter That specifies how to evaluate sentences in a language
  • Observer A way of notifying change to a number of classes
  • Command Encapsulate a command request as an object
  • Iterator Sequentially access the elements of a collection
  • Mediator Defines simplified communication between classes
  • Memento Provides the ability to restore an object to its previous state
  • State Encapsulate varying behavior for the same routine based on an object's state object
  • Chain of Responsibility A way of passing a request between a chain of objects
  • Strategy Encapsulates an algorithm inside a class
  • Template Method Defines the program skeleton of an algorithm in a method
  • Visitor Is a way of separating an algorithm from an object structure on which it operates.
  • Null object Designed to act as a default value of an object

###Web Presentation Patterns

###Base Patterns

  • Money Represents a monetary value

###More

  • Registry A global object that other objects can use to find common objects

to be continued…

External links

Books