======================================================================== Originally posted on http://groups.google.com/group/jquery-en/ 11 July 2007 ======================================================================== An open letter to non-Believers... A public jQuery forum is probably not the place to address non-Believers - that is, people who do not use jQuery - but my hope is that some of the Believers here will take this and pass it on to any non-Believers who they know, to help convert the Poor Sods who are wasting their time writing code to traverse and manipulate their [X]HTML DOMs. To help put this in context a bit, i want to lay my credentials out on the table, so that nobody will think that this letter is coming from a noob script-kiddie. My first line of code (in BASIC, no less) was pounded out on Christmas day of 1983. Since that day my life has more or less been centered around computing. Since 1994 i have worked professionally with computers, and since over 10 years i've earned my daily bread by programming in a variety of languages, such as Java, C++ and PHP. i run a couple of Open Source projects, such as http://toc.sf.net, http://SpiderApe.sf.net, and, my personal favourite, http://s11n.net. i also write technical papers from time to time (http://wanderinghorse.net/computing/papers/). So... now that that's out of the way... When i first caught wind of jQuery, the name made it sound like an SQL library for Java. As i have absolutely zero need for such a tool, i ignored jQuery. Over the months i came across more and more mentions of it on the net, and finally got curious enough to actually take a peek. On the home page of jquery.com we are immediately faced with the second arch-enemy of programmers everywhere: a Statement of Hype. It speaks thusly: "You start with 10 lines of jQuery that would have been 20 lines of tedious DOM JavaScript. By the time you are done it's down to two or three lines and it couldn't get any shorter unless it read your mind." - Dave Methvin Barf! Hype! (The first arch-enemy of programmers is of course the Marketing Department, who are themselves normally responsible for generating Hype. But, in fact, we have a symbiotic relationship with Marketing, so we should not bemoan them too much.) Despite the suspicious smell of Marketing, we poke around the site nonetheless. If jQuery is mentioned so often on the net, the implication is that there actually is something worth looking at. (Err... that doesn't always hold true, but that's another story altogether. *cough*PHPNuke*cough*) After perusing a few of the online examples, jquery seems to be pretty slick. With a download of only 21k, it is hard to resist downloading it, so we do. While it takes a little while to set up a few useful examples, the more we use jQuery, the more useful it seems to be. We continually return to the web site to browse the tutorials and API documentation. After a day or two we are fairly comfortable with it, and All is Good. Then we decide we need More. Now that jQuery has freed us from the Tedium of the DOM, we want our web pages to do More. We want to add animation effects, tabbed controls, and whatnot. Those are a lot of work to implement, and we have not, so far, done so because it is so tedious to do so. We start to write some code to implement them, and quickly give up in frustration, as jQuery has spoiled us so completely that our stomachs retch violently when we write "document.createElement(...)" and "document.getElementById()". Then we get the idea/hope that perhaps jquery can also help with such a job. Despite the fact that "query" has very little to do with such features (at least on the surface), we poke around the jQuery plugins repository to see what others have done. The size of the repository immediately impresses us. (But our enthusiasm is held in check by the memory of the great number of plugins written by script kiddies for crap software like PHPNuke.) Wow... not only are these additional features already available as plugins, but some of them are available in multiple flavours, so we can pick and choose. As we browse the plugins we note a pattern - the source code files for the plugins are typically under two kilobytes. Yes, 2k. Unheard of - complete, useful code that's under 2k? No way. Yes, brothers and sisters, it is possible. It is proven and demonstrated dozens of times over on jquery.com. But it is only possible because the jQuery developers have brought us such a Damned Slick framework. The word "framework" sounds suspiciously like Something from the Marketing Department, but don't let that deter you - simply interpret it as "a collection of pre-defined functionality off of which to build more functionality." (But "framework" is a lot easier to say.) If you do any significant amount of browser-based JavaScripting (as opposed to embedded code, such as using SpiderMonkey or Rhino), take a few minutes to look over jQuery. Then take a few hours to get comfortable with it. Then weep for all of the hours you've previously wasted writing tedious code to traverse and manipulate DOM nodes, and know that the days of the Tedium of the DOM have passed, and that we can now bask in the light of this next step in the evolution of JavaScript applications. http://jquery.com/ We now have a choice to make: 1) weep for those Poor Bastards who do not Believe, or 2) help the Poor Bastards who do not Believe. If you choose (1), then stop here and weep (or laugh) all you like. If you choose (2), pass around the jQuery URL (hint: http://jquery.com) to any Poor Bastards you know, point them to the numerious tutorials and the API documentation, and then watch gleefully as they sob away their pent-up frustrations and shout like madmen, "aaaarrrrgggghhhh! If I had only known this two weeks ago, before our project deadline had passed!" Amen, brothers and sisters. ----- stephan beal http://wanderinghorse.net/computing/javascript/ 11 July 2007 PS: i am in no way affiliated with jquery.com. In fact, i was, until very recently, one of the above-mentioned Poor Bastards.