Facade: Introduction

Get a brief introduction to the Facade design pattern.

We'll cover the following

The Facade design pattern is all about building a simple interface to abstract away the complexity of using multiple complex interfaces. For example, if our application needs to access multiple services and then perform some complex logic of coordinating the responses from those services, the Facade design pattern would allow us to isolate such functionality in one place. This will then be accessible by the rest of the application via a simple interface.

A real-life analogy could be a food delivery system. All we do is go to a website and select the items to order. Those items then get delivered to us. As a consumer, this is all we see happening. Behind the scenes, once we place an order, we trigger a whole complex system. The food needs to be prepared. The preparation of different items needs to be coordinated. The driver needs to be assigned. The delivery route needs to be planned.

Summarized concept of Facade

The Facade can be summarized as follows:

  • There are several Endpoint Interfaces.
  • Either the calls to the Endpoint Interfaces need to be coordinated, or the responses from them need to be aggregated in some way.
  • There’s a Facade object that performs all of this coordination.
  • The Facade object is accessible by the rest of the application via a simple interface.

Get hands-on with 1200+ tech skills courses.