O'Reilly logo

jQuery Design Patterns by Thodoris Greasidis

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

Using Facades in our applications

In order to demonstrate how facades can be used both to encapsulate complexity, helping us enforce the Separation of Concerns principle, and also abstract third-party library APIs into more convenient methods that are application centric, we are going to demonstrate a very simple lottery application. Our "Element Lottery" application will populate its container with some Lottery Ticket elements that will have a unique ID and contain a random number.

Using Facades in our applications

The winning ticket will be picked by randomly selecting one of the lottery elements, based on a random index among the created unique IDs. The winning number will then ...

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