An in-depth analysis of the structure patterns of PHP design Patterns _php Skills

Source: Internet
Author: User
Tags inheritance object model

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 the PHP design pattern.

The greatest advantage of the combination of objects is that you can build a relationship based on configuration at run time without modifying the actual code, which is an action required by class inheritance and interface implementations. In fact, you can define an application's functionality entirely by modifying the links between objects rather than between classes, which is part of the design.
List of structure patterns

adapters-bridging-appearance (Adapter-bridge-facade)

The goal of these three modes is to compete for coupling:
Adapter mode (Adapter) uses different interfaces to connect objects;
Bridging mode (bridge) separates an M abstraction layer and an N implementation layer into N+m class, instead of m*n usage;
The skin pattern (façade) creates a new unified interface to access the subsystem.

Composite-decoration-agent (composite-decorator-proxy)

These three modes maintain the same object interface, which transparently adds orthogonal attention, which the client does not perceive:
The composite mode increases the container organization hierarchy for other objects and reuses the tree as the leaves of other trees;
The decoration mode authorizes the addition of the behavior by intercepting method, avoiding the introduction of a large number of subclasses;
Agent mode gives an object authorization operation that does not yet exist or is difficult to access.

Finally, the privilege mode (Flyweight) is an identity-free valueobjects standard implementation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.