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 Adapter section 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 following is the class diagram of the façade pattern:
Implementation
If we take the same SimpleShip
class as before and expand it to an entire fleet, we have a great example of the use to create a façade. If it was difficult to sail a single ship, it would be far more difficult to command an entire ...
Get Mastering JavaScript Design Patterns 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.