The
Appearance mode is intended to provide an interface for the subsystem to facilitate the use of
appearance classes, tool classes, and example classes
appearance classes may all be static methods
The sample class shows how to use the class and subsystem
The difference between the sample class and the Appearance class:
1, the example class is usually a stand-alone The appearance class is not
2, and the sample class contains sample data. The Appearance class does not have
3, the appearance class is usually configurable, the example class is not
4, the intent of the appearance class is for reuse, the example class is not
5, the skin class is used in the product code, and the sample class is not
Java with less appearance analogies, The reason is that
1, Java developers typically require a holistic understanding of the tools in the library, and the appearance pattern may limit the way the system is used. The
2, Java class Library provides few appearance classes.
public class Encryptfacade {
private filereader reader;
Private FileWriter writer;
Private Ciphermachine cipher;
Public Encryptfacade () {
reader = new FileReader ();
writer = new FileWriter ();
cipher = new Ciphermachine ();
}
public void Fileencrypt (string filenamesrc,string filenamedesc) {
string plainstr = Reader.read (FILENAMESRC);
String encryptstr = Cipher.encrypt (PLAINSTR);
Writer.writer (ENCRYPTSTR,FILENAMEDESC);
}
/**
* @author Shu Yuwei
* @time 2015-2-7 a.m. 11:26:09
* @param args * * Public
static void Main (string[) args) {
Encryptfacade façade = new Encryptfacade ();
Facade.fileencrypt ("File Encryption", "appearance mode");
}
I just need to invoke a good encapsulation method and provide the user with the available interface, as to how the interface inside the method is implemented without having to be shown to the user.