Interview: Authors of jQuery in Action
According to Manning, the purpose of this book is to help you learn how to do more on your web application pages with less script. Bear Bibeault and Yehuda Katz, one a jQuery contributor and evangelist and the other an avid and enthusiastic user, believe that jQuery is the best library available today to help you do just that. In this interview to Javalobby, the authors tell us more about their book and jQuery as well.
1. Bear, Yehuda, tell us something about yourselves. Who you are, where you are located, and what kind of work do you do?
[img_assist|nid=1985|title=|desc=|link=none|align=left|width=100|height=100] Bear: Shouldn't there be a microphone? I've alway wanted to be interviewed with a microphone.
Well, I'm a software engineer living and working in Austin, Texas. I've been writing code for over three decades now, and besides having had exposure to just about every production language that?s been popular over the years, I've held positions from junior engineer to development manager.
Right now I've settled into a cozy niche as the architect for a large financial web application that's used by big companies to keep tabs on their internal credit card spending programs.
It's really not as boring as it sounds -- if it were, I'd have died of tedium long ago.
[img_assist|nid=1984|title=|desc=|link=none|align=left|width=100|height=86]Yehuda: I currently live in San Francisco and work for Engine Yard. We do a mix of Ruby on Rails hosting and Ruby development. I have the good fortune to be working full-time on Merb, an alternate (OSS) Ruby web-framework, which has been picking up steam lately in the Ruby community.
I also get to work on Rubinius from time-to-time. Rubinius is an up- and-coming Open Source Ruby VM, which is based loosely on the Smalltalk-80 VM. It's intended to be fully compatible with the current Ruby interpreter, but be written, as much as possible, in Ruby itself.
2. I see that you have a upcoming book “jQuery in Action”. Is this your first book?
Bear: No, actually it's my third, coming close on the heels of Prototype and Scriptaculous in Action, and Ajax in Practice. I've been writing non-stop for coming on two years now,and I think I'll take a bit of a break and try to remember what the rest of my house outside of my office looks like.
Yehuda: Yep. It's my first book. I contributed two chapters to Ruby in Practice, and am currently working on Merb in Action, all for Manning.
3. Who is your target audience?
jQuery takes a bit of a different approach. It only defnes two global names, and one of those is even optional!
That conveniently side-steps any pitfalls you can come across with other libraries, like when native objects don't act as expected, or having to worry about what names we canor can't use on the pages.
It also means that jQuery works and plays well with other libraries. If you want to usemore than one at a time for whatever reason, nothing in jQuery gets in the way of doingthat.
6. Why should we be using jQuery?
Bear: Because jQuery rocks!
Seriously, all of the reasons I already mentioned, but mostly because it just makesdoing the types of things we want to do in modern web applications so darned easy! In the book, I called this “doing more with less”. And that's exactly what jQuery brings to the party. You can write a lot less code, and do lot more nifty things on the pages. What's not to love?
Yehuda: Most of the time when writing Ajax applications, you find yourself needing to do something to some collection of elements. jQuery was built around this notion(Jeremy Keith calls it DOM-Scripting), which means that your day-to- day work is also the central mission of the framework.
7. What browsers support jQuery?
Bear: It's sort of the other way around. jQuery supports all the modern popular browsers: both isotopes of IE (6 and 7), the Gecko-based browsers like Firefox and Camino, the WebCore browsers like Safari and OmniWeb, and even Opera.
This is especially nice in areas like event handling and Ajax where the browser quirk shave always been a royal pain in the keester!
Yehuda: Heh. Yep. My favorite chapter in jQuery in Action is the event chapter, which details how the "jQuery Event Model" works. After detailing the flaws and complexity in the other event models, we show you just how easy jQuery makes it.
8. Can you tell our readers how jQuery works?
Bear: Sure. What makes jQuery so easy to pick up quickly is that most of the jQuery statements follow a similar pattern. You use the jQuery function to select which DOM elements you want to operate on, and then apply the jQuery methods to that set. You can even chain multiple commands to perform complex operations in a single statement.
It's incredibly easy to start being productive with jQuery right off the bat, and then get more and more clever with it as time goes on.
The jQuery selectors, which are simple CSS-based expressions that succinctly let us specify which DOM elements to choose for operating on, are the key to using jQueryeffectively.
Yehuda: jQuery supports almost all of the CSS3 selector set (except for a few arcane ones like :nth-child-of-type that were literally never used), as well as a numberof convenient additions like positional selectors (:lt, :gt, :eq), and form selectors(:button, :text, :radio, :selected).
9. Any tips and tricks for our readers who already are using jQuery?
Bear: Yes. Really spend some time wrapping your head around the jQuery selectors. Learning the methods is easy -- it's using the selectors cleverly that really gives you a lot of bangfor the buck!
Yehuda: I agree 100%. The best thing you can do to improve your utility from jQueryis to learn the available selectors.