Bkjia exclusive feature "in a random discussion of PHP design patterns, we learned that there are many similarities between structural patterns, because there are several relationships in the object model structure: inheritance and implementation between classes, plus object combinations, which are the main purposes of PHP design patterns.
For more on PHP design patterns, you can refer to Bkjia's previous reports: the model of responsibility chain of PHP design pattern ramble the proxy mode of PHP design pattern
The biggest advantage of object composition is that you can establish a relationship based on configuration at run time without modifying the actual code, which is an operation required for class inheritance and interface implementations. In fact, you can define the functionality of an application by modifying the links between objects rather than between classes, which is part of the design.
List of structural patterns
Adapter-bridging-appearance adapter-bridge-facade)
The goal of these three models is competitive coupling:
Adapter mode adapter) use different interfaces to connect objects;
Bridging mode Bridge) separates a M abstraction layer and an N implementation layer into a n+m class, instead of the m*n usage;
Appearance mode facade) create a new unified interface to access the subsystem.
Composite-decoration-agent Composite-decorator-proxy)
These three modes maintain the same object interface, they transparently add orthogonal attention, and the client does not perceive:
The compound mode increases the container organization hierarchy for other objects and reuses the tree as the leaves of other trees;
Decoration Mode Authorizes the addition of behavior by interception method, avoids introducing a lot of subclasses;
The proxy mode grants an operation to an object that does not exist or is difficult to access.
Finally, enjoy meta-mode flyweight) is a non-identity valueobjects standard implementation.
Original name: Practical Php patterns:structural Patterns Summary Author: Giorgio
Original source:http://giorgiosironi.blogspot.com/2010/02/practical-php-patterns-structural.html
- The model of responsibility chain of PHP design pattern ramble
- The proxy mode of PHP design pattern
- Top Ten tips for PHP developers to do more
- firephp: Debug your PHP code like Firebug
- How to correctly implement PHP to get blog data
http://www.bkjia.com/PHPjc/587974.html www.bkjia.com true http://www.bkjia.com/PHPjc/587974.html techarticle 51CTO exclusive feature "in a random discussion of PHP design patterns, we learned that there are many similarities between structural patterns because there are several relationships in the object model structure: The relay between Classes ...