`
pouyang
  • 浏览: 313342 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Design Patterns 结构模式 之 Facade 外观模式

 
阅读更多
2.1 Facade
外观模式
定义:它为子系统中的一组接口提供一个统一的高层接口。使得子系统更容易使用。


Facade有如下的优点:

1、 他对客户屏蔽了子系统组件,从而减少了客户处理对象的个数,使得子系统使用起来更加的方便。

2、它实现了子系统与客户之间的松耦合的关系,而子系统内部的 功能组件往往是紧耦合的。

3、 若果需要,它并不限制他们使用子系统类。因此你可以在系统易用性和通用性之间加以选择。

public class SubSystemA {

       protected SubSystemA ( ) {

                System.out.println("SubSystemA ");

      }

}

public class SubSystemB{

      protected SubSystemB ( ) {

              System.out.println("SubSystemA ");

      }

}

public class SubSystemC {

      protected SubSystemC ( ) {

             System.out.println("SubSystemA ");

      }

}

// facade class

public class Facade {

      public void doAll( ) {

                SubSystemA systemA = new SubSystemA ();

                SubSystemA systemA = new SubSystemA ();

                SubSystemA systemA = new SubSystemA ();

      }

      public static void main(String[] args) {

             new Facade().doAll;

      }

}




分享到:
评论

相关推荐

    Design Patterns(Structural):Facade

    NULL 博文链接:https://jnh.iteye.com/blog/1143262

    .NET Design Patterns [Kindle Edition]

    After reading this book, you will be able to convincingly leverage these design patterns (factory pattern, builder pattern, prototype pattern, adapter pattern, facade pattern, decorator pattern, ...

    Design.Patterns.Explained.Simply

    We've tried hard to avoid both of these categories with Design Patterns Explained Simply. This book is fast and simple way to get the idea behind each of the 29 popular design patterns. The book is ...

    Head First Design Patterns 英文版 Head First设计模式

    《Head First Design Patterns》共有14章,每章都介绍了几个设计模式,完整地涵盖了四人组版本全部23个设计模式。前言先介绍《Head First Design Patterns》的用法;第1章到第11章陆续介绍的设计模式为Strategy、...

    《Java Design Patterns》高清完整英文PDF版

    Learn how to implement design patterns in Java: each pattern in Java Design Patterns is a complete implementation and the output is generated using Eclipse, making the code accessible to all....

    jQuery Design Patterns(PACKT,2016)

    The book starts off with a refresher to jQuery and will then take you through the different design patterns such as facade, observer, publisher/subscriber, and so on. We will also go into client-side ...

    Apress.Pro.Design.Patterns.in.Swift

    Pro Design Patterns in Swift shows you how to harness the power and flexibility of Swift to apply the most important and enduring design patterns to your applications, taking your development ...

    Design Patterns in Modern C++--2018

    Implement structural patterns such as adapter, bridge, decorator, facade and more Work with the behavioral patterns such as chain of responsibility, command, iterator, mediator and more Apply ...

    Learning Python Design Patterns(PACKT,2013)

    Then you will move on to learn about two creational design patterns which are Singleton and Factory, and two structural patterns which are Facade and Proxy. Finally, the book also explains three ...

    Learning Python Design Patterns 2nd 2016第2版 无水印pdf 0分

    As you progress through the book, you will learn about Singleton patterns, Factory patterns, and Facade patterns in detail. After this, we'll look at how to control object access with proxy patterns....

    Head First Design Patterns

    第1章到第11章陆续介绍的设计模式为Strategy、Observer、Decorator、Abstract Factory、Factory Method、Singleton、Command、Adapter、Facade、Templat Method、Iterator、Composite、 State、Proxy。最后三章比较...

    Programming.in.the.Large.with.Design.Patterns

    It starts with a general introduction to all types of programming patterns and goes on to describe 10 of the most popular design patterns in detail: Singleton, Iterator, Adapter, Decorator, State, ...

    Head First Design Patterns 高清英文版

    第1章到第11章陆续介绍的设计模式为Strategy、Observer、Decorator、Abstract Factory、Factory Method、Singleton,Command、Adapter、Facade、TemplateMethod、Iterator、Composite、State、Proxy。最后三章比较...

    Design Patterns Elements of Reusable Object-Oriented Software

    • How Design Patterns Solve Design Problems • How to Select a Design Pattern • How to Use a Design Pattern A Case Study: Designing a Document Editor • Design Problems • Document Structure ...

    C++设计模式(Design Pattern)范例源代码

    外观模式(Facade) 蝇量模式(Flyweight) 代理模式(Proxy) 行为型: 责任链模式(Chain of Responsibility) 命令模式(Command) 解释器模式(Interpreter) 迭代器模式(Iterator) 中介者模式(Mediator) 备忘录模式...

    designPatterns:设计模式

    外观模式 Facade 享元模式 Flyweight 行为型设计模式 行为型模式都涉及到类和对象如何交互及分配职责。 中介者模式 Mediator 备忘录模式 Memento 解释器模式 Interpreter 状态模式 State 策略模式 Strategy 责任链...

    Head First Design Patterns 英文原版

    of Design Patterns so that you can hold your own with your co-worker (and impress cocktail party guests) when he casually mentions his stunningly clever use of Command, Facade, Proxy, and Factory in ...

Global site tag (gtag.js) - Google Analytics