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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.