Even though jQuery is famed for its succinctness, I quite wasn't prepared for just how true this would be. For the first few hours it seemed to reach well beyond "terse" and into the realm of "barren", until I realised that almost every function was overloaded to provide several different modes of operation. The top-level "$" function, for example, serves four different purposes: selecting nodes from the DOM, wrapping a DOM node in a jQuery object, creating new DOM nodes from HTML, and registering callbacks for the document load event.
Ordinarily I'm not a fan of overloading functions in this way, since explicit is better than implicit. But after working with jQuery for the past week, I have to admit that it works in this particular instance – the code is easy to write, easy to read, I'm genuinely writing less and doing more! There's definitely a unique "jQuery style" that takes a little getting used to, but John et. al. have a good eye for clarity of code and ease of use, so don't fight it. Remember, beautiful is better than ugly.
I'm certainly no rockstar just yet, but I'm enjoying what I see so far and looking forward to using jQuery more intensely over the coming weeks. I've even released a jQuery plugin called jquery-loadInline, a neat little function to make links and forms load their contents into a page element rather than changing the page location, producing a kind of "mini browser" within the page. At 213 lines of code and a few hours to write, it's a pretty solid return on my jQuery investment so far.
blog comments powered by Disqus