Abstract: Original creation Place: http://www.cnblogs.com/Alandre/sediment brick slurry Carpenter hope reprint, keep abstract, thank you! Preface
Visual inspection for a long time did not write articles, distance from the previous article also has more than 20 days. What's wrong with me? haha ~, two characters: life. Life seems so big, it's healthy. A fall into your wit.
Thinking about life to life
My faith? Buddhism? Christ? ... When you are ill, have medicine to eat. For example, cold medicine you will feel the medicine is terrible. People are like that, but when you think about it, you are sick of myrrh can eat is how helpless. Like my chest and chest pain. followed by a wave of fatigue, Shanghai-Wenzhou-Home Taizhou, run everywhere. Doctor, what? No disease? No
At that time, I think of the car is afraid, limbs weak. It's just the attention, the spirit is gone. Look at the code. I forgot what I was thinking about in Java.
Later, the Doctor medicine is not, oneself decadent ... That was the beginning of the school. Once again I went to school on a frightened train. I believe that I will slowly good, do not stay up late, regular rest. The first week is the longest day, the lecture is weak, sitting more waist pain. shit! Insist... Insist... And then it was obviously slow and powerful. The second week, I began to exercise, at present the first three weeks, I insisted on exercising for six days. Fuck My heath! I am coming, hope no so late.
II Appearance mode of contact
Look at the source is a kind of enjoyment, recent various look. It's OK to see, something is busy. I think it's expensive to study. haha ~ first time to see is here:
It is the so-called knowing that it is true to know it. Small decay do not understand, immediately went to Baidu under this facade. Know is a pattern, just ah, learn Bai. Said to check the video to see, looked at others blog. It is worth seeing why not look at it.
The appearance mode (facade) can be encapsulated into a simple closed interface by a series of complex packages. It can also be said that the outside of a subsystem and its internal communication must be through a unified facade object. Here the meaning of the communication: reciprocal effect. Its role provides a high-level interface that is easy to use.
Structure of the three appearance modes
Facade defines a simple calling interface for the caller.
The clients caller. An internal class group that provides a feature is called through the facade interface.
Packages feature provider. A class group (module or subsystem) that provides functionality
Small example of the appearance pattern of the restaurant
In reality, the 890 's when there was no fund. Bonds, stocks, futures ... are running on their own. For example, the following:
Stock:
public class Gupiao {public void Mai () { System.out.println ("Buy stock"); } }
Futures:
public class Qihuo {public void Chao () { System.out.println ("Buy Futures"); } }
Treasury bonds:
public class Guozai {public void Mai () { System.out.println ("buy National Debt");} }
If you want to buy Treasuries and buy futures, you will have to deal with the respective systems. New one of the objects to manipulate. So this will cause the following points:
1. Increase of coupling
2. Non-hierarchical, structure is not clear
Since the fund was available. What is a fund, according to the appearance of the model, is that you do not know how many kinds of stocks or what, the fund to help you manage these small systems. It helps you arrange a variety of programs, such as
Fund:
public class Jijin { private gupiao Gupiao; Private Guozai Guozai; Private Qihuo Qihuo; Public Jijin () { This.guozai = new Guozai (); This.gupiao = new Gupiao (); This.qihuo = new Qihuo (); } public void Maijijina () { this.guozai.mai (); This.gupiao.mai (); } public void Maijijinb () { this.guozai.mai (); This.gupiao.mai (); This.qihuo.chao (); } }
Test Case:
public class MainClass {public static void Main (string[] args) { Jijin Jijin = new Jijin (); Jijin.maijijinb (); } }
In this way, its practicality comes out:
1. Provides a simple interface for a complex subsystem.
2. Improve the independence of the subsystem.
3. In a hierarchical structure, you can use the facade pattern to define the entry for each layer in the system.
Wooth Test in the Web
1 Web three-tier architecture, in fact, in the data access layer and the business logic layer, the business logic layer and the presentation layer between the layer and layer to establish the appearance of facade mode application, for the complex subsystem to provide a simple interface or abstract class, so that the coupling greatly reduced.
2 in the development phase, subsystems tend to become more and more complex because of the evolution of the continuous reconstruction, most of the patterns will produce a lot of very small classes, this is good, but also to the external call their user program brought difficulties in the use of, increase the appearance of facade can provide a simple interface, Reduce the dependency between them.
Specific practices: the small categories of planning, classification. Then implement proxy facade.
3 when maintaining a legacy large system, it is possible that the system is very difficult to maintain and extend, but because it contains very important features, new requirements development must depend on it. It is also very suitable to use the appearance mode facade. For example, you can develop an appearance facade class that provides a clearer and simpler interface for designing rough or highly complex legacy code, allowing the new system to interact with facade objects, facade all the complex work of interacting with legacy code.
Lu thanked the source of knowledge and summary
Can be widely used in Web, project architecture. Come on!!
Resources:
Google articles and their own experience.
If the above articles or links are helpful to you, don't forget to click the "Like a" button on the article button or in the bottom right corner of the page. You can also click on the right side of the page "share" hover button oh, let more people read this article
Accumulation in the Web: Appearance mode facade