BKJIA exclusive Article: We learned in the PHP design patterns forum that there are many similarities between structure patterns, because there are several relationships in the object model structure: the Inheritance and implementation between classes and the combination of objects are the main purposes of the PHP design pattern.
For more information about PHP design patterns, see previous reports on BKJIA:PHP design pattern: responsibility chain pattern Proxy mode in PHP design mode
The biggest advantage of object combination is that you can establish a relationship based on the configuration at runtime without modifying the actual code. It is an operation required for class inheritance and interface implementation. In fact, you can define the function of an application by modifying the link between objects rather than between classes, which is part of the design.
Structure Mode list
Adapter-Bridge-appearance Adapter-Bridge-Facade)
The goal of these three models is competition coupling:
◆ Adapter mode Adapter) use different interfaces to connect objects;
◆ Bridge Mode) separates an M abstraction layer and an N Implementation Layer into N + M classes, replacing M * N usage;
◆ Appearance mode Facade) create a unified interface to access the subsystem.
Composite-Decoration-Proxy Composite-Decorator-Proxy)
These three modes maintain the same object interface, and they add orthogonal attention transparently, so the client will not notice:
◆ The composite mode adds a container organization hierarchy for other objects and reuse the tree as the leaves of other trees;
◆ The decoration mode authorizes the addition of behaviors through interception methods to avoid introducing a large number of child classes;
◆ Authorize an object that does not exist or is difficult to access in proxy mode.
Finally, the enjoy meta mode Flyweight) is an unauthenticated ValueObjects standard implementation.
Original article name: Practical Php Patterns: Structural patterns summary Author: Giorgio
Source:Http://giorgiosironi.blogspot.com/2010/02/practical-php-patterns-structural.html
- PHP design pattern: responsibility chain pattern
- Proxy mode in PHP design mode
- Top 10 tips for PHP developers to get twice the result with half the effort
- FirePHP: Debug your PHP code like Firebug
- How to correctly implement PHP to obtain blog data