Interpreting Design Patterns----Proxy patterns (proxy pattern)

Source: Internet
Author: User

One of those things about buying a computer

I have been using the desktop, can always feel inconvenient, especially carry, take a tenant after the move to say, the cost of a lot of strength. For a variety of reasons there is a desire to change the idea of a notebook. 5.1 Holiday and a good friend to the computer city to stroll a circle, a computer city will see: "HP Notebook XX General agent, IBM notebook monopoly, XX computer yy general agent ...".

See a lot of home sales shop, give me the deepest impression is everywhere is XX brand computer monopoly and agents, on the same floor I saw the same brand has 6 agents sales shops. Oh, it seems that we buy a computer directly to find sales agents can be, there is no need to find manufacturers, manufacturers to produce a computer is to sell products to the market, and agents in the process to replace the manufacturer to sell products. This reminds me of the object-oriented design pattern-proxy model.

Ii. talking about proxy model

1, the agent mode of intent:

Provides a proxy for other objects to control access to this object.

As a computer sales agent, he is responsible for providing an agent to control how computers are sold to computer manufacturers.

2, Agent mode UML diagram (the following figure selected from http://www.dofactory.com/):

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.