Summary

The Facade pattern is so named because it puts up a new front (a facade) in front of the original system.

The Facade pattern applies when

  • You do not need to use all of the functionality of a complex system and can create a new class that contains all of the rules for accessing that system. If this is a subset of the original system, as it usually is, the API that you create in new class should be much simpler than the original system's API.

  • You want to encapsulate or hide the original system.

  • You want to use the functionality of the original system and want to add some new functionality as well.

  • The cost of writing this new class is less than the cost of everybody learning how to use the original system or is less than you would spend on ...

Get Design Patterns Explained: A New Perspective on Object-Oriented Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.