Using the jQuery Plugin Boilerplate
The jQuery Boilerplate project, which is available at https://github.com/jquery-boilerplate/jquery-patterns, offers several templates that can be used as starting points for the implementation of robust and extensible plugins. These templates incorporate a lot of best practices and design patterns such as those analyzed earlier in this chapter. Each of the templates packs a number of best practices that work well together, in an attempt to provide good starting points that better match the various use cases.
Perhaps the most widely used template is jquery.basic.plugin-boilerplate
from Adam Sontag and Addy Osmani, which even though it is characterized as a generic template for beginners and above, successfully covers most aspects of jQuery plugin development. What makes this template unique is the Object-Oriented approach that it follows which is presented in such a way that it helps you write better structured code, without making it harder to introduce...