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"