[jQuery] Re: Plug-in Developers...
One thing I learnt recently is that just because you can use jQuery doesn't mean the innards of your plugin should be one big chain of jQuery methods. For example, see Scott's Overlabel blog page... Scott's original version used plain JS to do things, however it was a bit difficult to read: http://scott.sauyet.com/thoughts/archives/2007/03/31/overlabel-with-jquery/ Then Dave came along with a jQuery version of the same code which was more compact and easier to read: http://scott.sauyet.com/thoughts/archives/2007/03/31/overlabel-with-jquery/#comment-24144 Finally, Aristotle came along with a super-clean bit of JS that only used jQuery where it was absolutely necessary - this was far easier to read and as far as I can tell uses less method/function calls resulting in it also being a bit faster. http://scott.sauyet.com/thoughts/archives/2007/03/31/overlabel-with-jquery/#comment-24205 While I resisted at first, Aristotle proved to me that clean JS should be used wherever possible to aid readability of the code. He helped me kick my method chaining addiction within plugin code :) Note: Chaining is still very useful for general jQuery use, but should only be used sparingly within the plugin itself if possible. Aristotle also noted that it /might/ be better to use jQuery.fn.extend() to define functions: http://scott.sauyet.com/thoughts/archives/2007/03/31/overlabel-with-jquery/#comment-24211 The comments system on the blog allowed other people to chip in with their own ideas, eg. support for JSF forms, support for existing forms where the HTML markup could not easily be changed, etc. The discussion enabled the plugin to be quickly polished to perfection (still some final tweaks to be made, eg. returning jQuery object to allow the method to be part of a chain). Guy
[jQuery] Re: Plug-in Developers...
Thanks for your work on your plug-ins and documentation, Ben. I know it's very *easy* to forget what the "$" means or to get the path wrong for a js file link, or even to forget to include a link at all! When introducing jQuery and plug-ins, they key is *baby steps* all the way. Like a "jQuery for Dummies" or "jqGalView jQuery Plug-in for Dummies" approach. There's a reason those books are making someone rich. Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Benjamin Sterling Sent: Monday, October 01, 2007 1:20 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Plug-in Developers... Rick, I agree with you and as far as my plugins and myself are concerned, it is a learning experience for me also. Almost all my code prior to coming upon jQuery has been "for my eyes only" and never thought twice about someone else needing to understand what I heck I am trying to do. But since developing my first plugin jqShuffle, my commenting and instructions have improved, eg. jqGalView, but that is only because of the questions that were asked. The questions asked help me understand where I needed to improve in my instructions and wording. My point is, and I am assuming it is the same for all new plugin developers who never had to make their code usable of others, that it is a learning experience and can only get better with "constructive" tips. Thanks for bring this up again Rick, keeping good documentation on the front burner is very good for us all. On 10/1/07, Rick Faircloth < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Good morning, all. After seeing that some who are new to jQuery wrestle with trying to get something working, I had the idea that perhaps we need a "Quick Start Guide" for jQuery generally and plug-ins specifically. What experienced users can grapple with the sometimes overwhelming amount of info involved with jQuery as a whole, newbies get lost quickly, especially those who have no previous js experience. and that would be a major part of the growing user base, I would think, of jQuery. I'm one of those newbies with little prior js experience. However, I've been around jQuery and the community that I kind of "get the system". Once someone is experienced with jQuery, it's easy to look at this with "new" eyes. Developers, Team Members, if it's not already there, please consider offering a "bottom-up", "nothing-assumed", "Quick Start Guide" to whatever is being explained. That's where newbies will almost always turn for a quick, gratifying experience. After success with that, they dig deeper as the addiction grows! Thanks for listening (or rather, reading)! Rick -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com http://www.benjaminsterling.com
[jQuery] Re: Plug-in Developers...
One massive tip for developing plugins, is to make them futureproof and compatible with the jQuery.noConflict() is to develop your plugin inside a closure: (function($){ ... })(jQuery); This means you can use. $ inside your plugin and never worry about it not working with jQuery. Since I use .noConflict() in my app, I've seen problems with many plugins that are not developed this way. On 01/10/2007, Benjamin Sterling <[EMAIL PROTECTED]> wrote: > Rick, > I agree with you and as far as my plugins and myself are concerned, it is a > learning experience for me also. Almost all my code prior to coming upon > jQuery has been "for my eyes only" and never thought twice about someone > else needing to understand what I heck I am trying to do. But since > developing my first plugin jqShuffle, my commenting and instructions have > improved, eg. jqGalView, but that is only because of the questions that were > asked. The questions asked help me understand where I needed to improve in > my instructions and wording. > > My point is, and I am assuming it is the same for all new plugin developers > who never had to make their code usable of others, that it is a learning > experience and can only get better with "constructive" tips. > > Thanks for bring this up again Rick, keeping good documentation on the front > burner is very good for us all. > > On 10/1/07, Rick Faircloth <[EMAIL PROTECTED]> wrote: > > > > Good morning, all… > > > > > > > > After seeing that some who are new to jQuery wrestle > > > > with trying to get something working, I had the idea that perhaps > > > > we need a "Quick Start Guide" for jQuery generally and > > > > plug-ins specifically. > > > > > > > > What experienced users can grapple with the sometimes overwhelming > > > > amount of info involved with jQuery as a whole, newbies get lost quickly, > > > > especially those who have no previous js experience… and that would be > > > > a major part of the growing user base, I would think, of jQuery. I'm one > > > > of those newbies with little prior js experience. > > > > > > > > However, I've been around jQuery and the community that I kind of > > > > "get the system"… > > > > > > > > Once someone is experienced with jQuery, it's easy to look at this > > > > with "new" eyes. > > > > > > > > Developers, Team Members, if it's not already there, please consider > > > > offering a "bottom-up", "nothing-assumed", "Quick Start Guide" to > > > > whatever is being explained. That's where newbies will almost always > > > > turn for a quick, gratifying experience. After success with that, they > > > > dig deeper as the addiction grows! > > > > > > > > Thanks for listening (or rather, reading)! > > > > > > > > Rick > > > > > > -- > Benjamin Sterling > http://www.KenzoMedia.com > http://www.KenzoHosting.com > http://www.benjaminsterling.com > -- Tane Piper http://digitalspaghetti.me.uk This email is: [ ] blogable [ x ] ask first [ ] private
[jQuery] Re: Plug-in Developers...
Rick, I agree with you and as far as my plugins and myself are concerned, it is a learning experience for me also. Almost all my code prior to coming upon jQuery has been "for my eyes only" and never thought twice about someone else needing to understand what I heck I am trying to do. But since developing my first plugin jqShuffle, my commenting and instructions have improved, eg. jqGalView, but that is only because of the questions that were asked. The questions asked help me understand where I needed to improve in my instructions and wording. My point is, and I am assuming it is the same for all new plugin developers who never had to make their code usable of others, that it is a learning experience and can only get better with "constructive" tips. Thanks for bring this up again Rick, keeping good documentation on the front burner is very good for us all. On 10/1/07, Rick Faircloth <[EMAIL PROTECTED]> wrote: > > Good morning, all… > > > > After seeing that some who are new to jQuery wrestle > > with trying to get something working, I had the idea that perhaps > > we need a "Quick Start Guide" for jQuery generally and > > plug-ins specifically. > > > > What experienced users can grapple with the sometimes overwhelming > > amount of info involved with jQuery as a whole, newbies get lost quickly, > > especially those who have no previous js experience… and that would be > > a major part of the growing user base, I would think, of jQuery. I'm one > > of those newbies with little prior js experience. > > > > However, I've been around jQuery and the community that I kind of > > "get the system"… > > > > Once someone is experienced with jQuery, it's easy to look at this > > with "new" eyes. > > > > Developers, Team Members, if it's not already there, please consider > > offering a "bottom-up", "nothing-assumed", "Quick Start Guide" to > > whatever is being explained. That's where newbies will almost always > > turn for a quick, gratifying experience. After success with that, they > > dig deeper as the addiction grows! > > > > Thanks for listening (or rather, reading)! > > > > Rick > -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com http://www.benjaminsterling.com