A learning journey based on design patterns-appearance patterns (with source code)

Source: Internet
Author: User
A learning journey based on design patterns -----Appearance Mode 1, Initial appearance Mode

Stock:EachInvestors directly purchase various types of stocks (common)

Fund: Investors deal with experts to allow expertsAgree to selectStock to be purchased (appearance)

2, What is appearance mode?

Provides a consistent interface for a group of interfaces in the subsystem,F A C A D EMode defines a high-level interface, which makes this subsystem easier to use.

3, Schema Structure

4, ModeCodeExamples 4.1 Classes involved

Fa C Ade(Foundfacade)

Subsystem(Sotcka,Sotckb,Sotckc)

4.2 Specific Code Implementation

Foundfacade

 

Sotcka

Sotckb

 

Patternrun

 

Nopatternrun

4.3 Result of case output

5, Advantages and disadvantages

A,It shields sub-system components from the customer, thus reducing the number of objects processed by the customer and making the sub-system more convenient to use.

B,It implements loose coupling between subsystems and customers, while functional components inside the subsystems are usually tightly coupled.

C,If the application needs it, it does not limit the use of sub-system classes. Therefore, you can choose between the ease of use and versatility of the system.

6, Applicability

AWhen you want to provide a simple interface for a complex subsystem.

B,CustomerProgramThere is a large dependency between the implementation part of the abstract class.

C,UseF A C A D EMode defines the entry point of each layer in the subsystem

 

Click to download "documentation and source code download"

Please refer to the source "http://www.cnblogs.com/luxiaofeng54/archive/2013/04/05/3000536.html"

 

 

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.