What are the advantages of java facade mode
This article mainly introduces the relevant knowledge of the advantages of java facade mode, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will gain something after reading this java facade model article. Let's take a look at it.
1. Reduce the interdependence of the system. If you do not use elevation mode, external access goes directly into the subsystem.
This is a strong coupling relationship, which is unacceptable to the system design. The output of the facade mode solves this problem very well, and all the dependencies are dependent on the facade object and have nothing to do with the subsystem.
2. Improve the flexibility. With less dependence, flexibility naturally increases.
3. Improve the security. If you want to access the business of the subsystem, open the logic, and the methods that are not open on the front cannot be accessed.
Example
Package com.sl.demo.facade;/** * computer (facade role) * @ author pengkun * * / public class Computer {/ / contains subsystem private CPU cpu;private GraphicsCard graphicsCard;private Memory memory;public Computer () {super (); this.cpu = new CPU (); this.graphicsCard = new GraphicsCard (); this.memory = new Memory ();} / turn on public void start () {System.out.println ("computer is on.") ; cpu.start (); graphicsCard.start (); memory.start ();} / close public void stop () {System.out.println ("the computer is turned off.") ; cpu.stop (); graphicsCard.stop (); memory.stop ();}} this is the end of the article on "what are the advantages of the java facade model". Thank you for reading! I believe you all have a certain understanding of the knowledge of "what are the advantages of java facade model". If you want to learn more knowledge, you are welcome to follow the industry information channel.