课程: Python: Advanced Design Patterns (2018)

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Facade

Facade

- [Instructor] How many of you know all the inner workings of a car when you drive one? You start a car by interacting directly and individually with your starter motor, fuel pump, ignition, battery, and, finally, your engine. As we all know very well, there is no need to do this and all that's required is a push of a button or turn of your car key. The more you hide the unnecessary details, the better. The same principle applies to the concept of Facade. The pattern hides the nonessential details of the individual interfaces of subsystems that comprise a complex system such as a compiler. Facade is a structural pattern and consists of a Facade class and a set of subsystems it represents through its own simple and unified interface. This way, the users of the Facade interface don't have to know all the details of the subsystem interfaces to use their functionality. The before and after diagram shown here demonstrates the difference Facade makes intuitively. In addition to the obvious…

内容