CHAPTER 10The Facade Pattern

The facade pattern does two things: it simplifies the interface of a class, and it decouples that class from the client code that uses it. In JavaScript, facades are often a developer's best friend. Facades are the core principle behind nearly all JavaScript libraries. The facade pattern can make library utilities easier to understand by creating convenience methods that allow complex systems to be used easily and simply. Facades provide programmers with the ability to indirectly interact with subsystems in a manner that is less buggy and less error-prone than accessing the subsystem directly.

The facade pattern simplifies common or repetitive tasks such as error logging or keeping track of page-view statistics. ...

Get Pro 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.