A tutorial on the structure pattern of PHP design pattern _php

Source: Internet
Author: User
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

    1. The model of responsibility chain of PHP design pattern ramble
    2. The proxy mode of PHP design pattern
    3. Top Ten tips for PHP developers to do more
    4. firephp: Debug your PHP code like Firebug
    5. 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 ...

  • Related Article

    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.