1 / 18

Façade Pattern

Façade Pattern. Jeff Schott CS590L Spring 2004. What is a façade?. 1) The principal face or front of a building 2) A false, superficial, or artificial appearance. What is the intent?. Provide a unified interface to a set of interfaces in a subsystem

khuong
Download Presentation

Façade Pattern

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Façade Pattern Jeff Schott CS590L Spring 2004

  2. What is a façade? 1) The principal face or front of a building 2) A false, superficial, or artificial appearance

  3. What is the intent? • Provide a unified interface to a set of interfaces in a subsystem • Define a higher-level interface that makes a subsystem easier to use

  4. Motivation • Structuring a system into subsystems helps reduce complexity • Minimize communication dependencies between subsystems • Introduce a façade that provides a single simplified interface

  5. Provides a single interface to clients

  6. Example - Compiler Compiler subsystem contains classes: • Scanner • Parser • ProgramNode • BytecodeStream • ProgramNodeBuilder

  7. Most clients don’t care about details like parsing and code generation • Compiler subsystem includes a Compiler class - unified interface

  8. Applicability • Provide a simple interface to a complex system • Reduce dependencies between clients and implementation classes • Layered subsystems - façade provides an entry point to each layer

  9. Structure

  10. Benefits • Shields clients from subsystem components • Promotes weak coupling between the subsystem and clients • Doesn’t prevent clients from accessing subsystem classes if necessary

  11. Implementation Considerations • Coupling between clients and the subsystem can be further reduced by making the façade an abstract class • Public v. Private subsystem classes

  12. Sample Code

  13. Sample Code

  14. Sample Code

  15. Sample Code

  16. Sample Code

  17. Related Patterns • Abstract Factory • Mediator • Singleton • Adapter • Decorator

  18. Questions?

More Related