jQuery plugins: Five tips for separating the good from the bad and the ugly
I opined recently that jQuery plugins can be more trouble than they're worth. That said, they're often indispensable. True, the worst plugins suffer from bloated code, confusing APIs and too many features. But the best provide instant black-box functionality with just a little configuration. The trick is figuring out which plugins are worth the effort and which ones aren't. Here are five tips for doing just that.
-
Peek under the hood
The quickest way to determine whether to place your trust in a plugin is to look at the actual code. Does it come with a fully commented version or only a minified production version? Assuming the former, how well is the code factored? Does it follow the standard plugin development pattern? Does it add just one new overloaded method to the jQuery object, or does it litter the namespace with random, one-off methods? Does it include smart defaults for instant invocation, or must you pass in a cryptic options hash with way too many possible configurations? In short, does it achieve the same quality level you aspire to in your own code?
-
Read the book - or at least the docs
Assuming the actual code passes the sniff test, check out the documentation. Does it cover all the bases, or is it just an overgrown blog post? Is your particular use case covered? Are the examples real-world ones, or radically simpler ones than the use to which you'll be putting the plugin? Time spent overcoming the "missing manual" syndrome is time better spent writing your own solution to the problem.
-
Check the version history
Is the plugin hosted at Google Code or some other public repository? Failing that, does its download page at least offer a dated archive of earlier versions? Assuming the answer to one of these questions is "yes," how often has the code been updated? Is this a viable project, or demoware from 18 months ago that hasn't seen a maintenance release, let alone new features, since it was launched?
-
Parse the stylesheets
jQuery UI now offers custom themes, but lots of older plugins include their own, required stylesheets. The CSS code in these assets is just as big an indicator of quality as the JavaScript itself. If the included stylesheets make global modifications to base HTML tags or otherwise interfere with your own styles, stay very far away.
-
Fire up an obscure browser
Assuming the plugin offers some live demo code, fire up Safari 2.x for the Mac, Safari 3.x for Windows, IE6 or any other non-Mozilla browser. Does the demo work there? If not, chances are this plugin's not for you. jQuery itself papers over the most fundamental cross-browser issues. But for date-pickers, lightboxes and other UI-intensive components, the devil's in the details - and those details need to work everywhere.
Up next: Tomorrow, I'll play favorites and actually review the better jQuery plugins I've employed. Along the way, I'll explain why each one's a winner.
Topics: Ajax, Ajax libraries, Javascript, jQuery, plugin
Comments: 1 so far
Leave a comment
About Pathfinder
Follow the Blog
-
Get a monthly update on best practices for delivering successful software.
Subscribe via email
Subscribe via RSS
Categories
Topics
Archives
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
Blogroll
Recent
- Elements of Testing Style
- Aesthetics and Web Design
- Asterisk-Java Testing with Groovy
- 3 Misuses of Code Comments
- Fluently NHibernate
- Digging a Hole and Covering it with Leaves — The Software Development Version
- The Importance of User Experience - Do You Understand It in Your Bones?
- Writing Your Own Protocol With NSURLProtocol
- What’s In Your Dock: iPhone edition
- Feature Fatigue

[...] Yesterday I discussed how to separate the jQuery plugin wheat from the chaff. Today, I offer a completely subjective and biased list of jQuery plugins to know and love. [...]
Pingback by Pathfinder Development » Five jQuery plugins that are a joy to use, Tuesday, July 22, 2008 @ 3:16 pm