当前位置:网站首页>[designmode] facade patterns

[designmode] facade patterns

2022-07-07 16:36:00 weixin_ forty-three million two hundred and twenty-four thousan

Basic introduction

  1. Appearance mode (Facade), Also called “ Process mode : A skin mode is a set of interfaces in a subsystem Provide a consistent interface , This pattern defines a high-level interface , This interface makes this subsystem easier to use

  2. The facade pattern defines a consistent interface , use To shield the details of internal subsystems , bring The caller only needs to call this interface , You don't need to care about the internal details of this subsystem

1. Cinema Management Project

Set up a home theater :

DVD player 、 Projector 、 Auto screen 、 Surround sound 、 Popcorn machine , It is required to complete the function of using home theater , The process is :

Directly with the remote control : Coordinate the switch of each equipment

Open the popcorn machine

Put down the screen

Turn on the projector

Turn on the stereo

open DVD, choose dvd

Go get the popcorn

Dim the lights

Play

After watching the movie , Shut down the devices

2. Traditional way to solve theater management

Class diagram :

 Insert picture description here

Code :

ClientTest{ 
    
    public static 
原网站

版权声明
本文为[weixin_ forty-three million two hundred and twenty-four thousan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071416475236.html