O'Reilly logo

Mastering JavaScript Design Patterns - Second Edition by Simon Timms

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Façade

The façade pattern is a special case of the Adapter pattern that provides a simplified interface over a collection of classes. I mentioned such a scenario in the section on the adapter pattern but only within the context of a single class, SimpleShip. This same idea can be expanded to provide an abstraction around a group of classes or an entire subsystem. The façade pattern in UML form looks like the following diagram:

Façade

Implementation

If we take the same SimpleShip as before and expand it to an entire fleet, we have a great example of a use for creating a façade. If it was difficult to sail a single ship it would be far more difficult to command ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required