A Bear of an Interview (but in a good way)

by Mapraputa Is

JavaRanch: Thank you for agreeing to answer our questions, Bear. Before we start, I need to read you your rights. You have right to keep silent, if you don't want to answer some question for whatever reason, or without reason at all, just skip it. You also have the right to write your own questions and answer them – it's a "DIY" kind of interview. Remember that everything you say can and will be used against you.

Bear Bibeault: I have read and understand my rights.

JR: Why did you choose JavaScript over real programming?

BB Where's the camera? Shouldn't there be a camera or something? Oh wait, this is an online interview. Never mind. What was the question?

JR: Why did you choose JavaScript over real programming?

BB: Is my tie on straight?

JR: Sigh, you're not wearing a tie. Are you always this way?

BB: No. Sometimes I tend to wander off the subject.

JR: Why did you choose JavaScript over real programming?

BB: (chuckles) Well, first of all, let's ditch the notion that JavaScript is somehow not a real language. We have seen a rather interesting phenomenon with JavaScript in that, of all the languages in broad use today, JavaScript is probably the most widely used, but little understood language.

JavaScript is included in millions and millions of web pages, but most page authors don't deeply understand the language that they are using. As a functional language, JavaScript is actually quite interesting, almost fascinating.

Luckily, today's focus on Rich Internet Applications and Ajax has sparked an interest in JavaScript that's leading more and more page authors to delve into the language itself. A movement I call "Beyond the Image Roll-over".

I've met a lot of people who claim that they hate JavaScript but I've found that for the most part they either haven't really taken the time to understand the language and give it a fair shake, or are reacting to the browser DOM (which is an abomination). Or both!

As to why I chose it... Well, I didn't. It chose me!

JR: How is that?

BB: Anyone who's followed my posts on JavaRanch knows that my core competency is server-side Java, particularly Servlets and JSP. But as with all serious web developers, I have to wrap my mind around the myriad alphabet soup technologies that a good web devo needs in his toolbox. And yes, that includes JavaScript.

I've proposed a few books on server-side technologies, but none of them have gone anywhere. The general consensus seems to be that "everything that needs to be written about Servlets and JSP has already been written". I don't happen to believe that that's true, but I guess that I haven't been all that convincing as of yet.

But RIAs and Ajax are things that people want to read and learn about, so that's what publishers are interested in. And so the three books I've written to date focus on the client side of things. You gotta write what people want to read!

But I haven't completely given up on my idea for a book on JSP...

JR: What should server-side Java programmers know about recent developments in JavaScript?

BB: Well, obviously the advent of Ajax has had an impact on how the server side is written. While the big, full-page refreshes are still alive and well (despite the predictions of their demise), they are augmented by increasing hoardes of smaller requests made via Ajax to "service" that page until the time comes for it to be replaced.

Which not only brought the concept of HTML fragments to the server side (as opposed to the predominance of full HTML pages), it also brought JSON into the mix.

And now, with the addition of the scripting engine and Rhino to Java 1.6, well, that's a whole 'nuther ball of worms that server-side devos need to figure out how to use to best advantage.

JR: What are the perspectives for JavaScript as a language? Where can it expand to?

BB: Well, as I said, to the server. Netscape flirted with server-side JavaScript in the past, but that rather went the way of the dodo. But with full Java support and the power of the Rhino engine behind it, JavaScript's migration to the server is all but assured. Just how it will be used is anyone's guess at this point. But we're a clever bunch – we'll figure it out.

JR: So many web technologies have come and gone; how has JavaScript managed to survive?

BB: Every shiny new thing that comes along seems to go through a phase where it is going the be "the killer app" that knocks HTML and JavaScript off the web. It never happens.

HTML and JavaScript are the basic building blocks upon which the web is built. Shiny new things either build upon these blocks, or compete in a niche.

JavaScript is here to stay. Something is going to have to be very very very shiny in order to knock it aside. I just don't see it happening anytime in the foreseeable future.

JR: What do you feel is the most powerful aspect of JavaScript?

BB: Its basis in functional programming – the very aspects that most people who use JavaScript don't really understand.

I try very hard to emphasize these aspects, both in my books, as well as in my posts to JavaRanch. If more page authors truly understood JavaScript's functional concepts like closures and function contexts, the state of scripting on the web would be vastly improved.

JR: You mentioned JSON. What's that all about?

BB: JSON, which stands for either JavaScript Object Notation, or JavaScript Serialized Object Notation, depending upon who you are talking to, is essentially a way of describing JavaScript data constructs based upon the syntax of JavaScript object literals. It's a great data interchange format and is turning out to be very well-suited to moving data from the server to the client.

JR: Why is that?

BB: It's incredibly easy to digest on the client. XML is a bear (in a bad way) to digest with its rather heavyweight API. JSON only requires a simple call to eval() and you're done!

It's also easy to generate and lots of server-side tools for dealing with it are cropping up. It's not going to push XML off its data interchange throne anytime soon, but as far as Ajax is concerned, XML can no longer claim to be King of the Hill.

Do you remember that board game, King of the Hill? It had this plastic mountain with a crown at its peak...

JR: You mentioned wanting to write a book on JSP. Why do you think we need one more?

BB: ... and it had marbles as playing pieces ....

JR: Why do you think we need one more JSP book?

BB: ... and all these traps you could fall into.

JR: Focus! Book! On JSP.

BB: JSP underwent a major revolution with JSP 2.0 and no one seems to have noticed. Oh, people are starting to use the JSTL and the EL (Expression Language) more and more – but a lot of them are still writing web apps the same old way that they used to with JSP 1.x. They're just trying to replace scriptlets line-by-line with JSTL/EL and finding out that that's not really where it's at.

Or worse: mixing scriptlets with JSTL/EL. (shudders)

To really take advantage of the "new JSP way", people need to change some of the ways that they think about using JSP pages. Not a whole lot – but more than I've been seeing happen.

There are also some neat tips and tricks that I've learned along the way, some of which I've written about in previous Journal articles, that I'd like to share with a wider audience.

JR: OK, back to the books you have written. The three books are Prototype and Scriptaculous in Action in March 2007, Ajax in Practice in May 2007 and earlier this year jQuery in Action came out. All three are about the latest developments in JavaScript... Does it feel like you are writing one book? If not, how are they different?

BB: Well the Prototype and jQuery books are similar in that they describe popular JavaScript libraries, but the books are very different because the approach of the libraries themselves is so very different. Prototype makes JavaScript look a lot like Ruby and adds a lot of names and classes to the global space, as well as modifying the behavior of existing JavaScript classes and elements. jQuery, on the other hand, promotes the concept of Unobtrusive JavaScript and itself makes little incursion into the global namespace (two names, one of which is optional) by using the Wrapper Pattern to add functionality to JavaScript elements without being invasive. They really couldn't be more different if they tried. Actually, I guess they did try pretty hard...

These days, I always highly recommend adopting a JavaScript library such as Prototype or jQuery especially if you're going to be doing any Ajax. There are so may pitfalls and browser quirks that these libraries handle for you that it's madness to try and write it all yourself. Why hit yourself in the middle of the forehead with a ball-peen hammer if you don't have to?

Ajax in Practice is very different from the other two books in that it shows how to use Ajax to solve real-world problems that web developers face every day. It's perfect for either people who already know some Ajax and want to put it to good use, or people who have heard about Ajax and want to know if it can help them solve some of the issues that they've been encountering.

Now can I ask you a question?

JR: Ask me a question? No, not really.

BB: What is your main goal when interviewing people?

JR: To make them discover something about themselves, something they didn't know?

BB: I didn't know that I was so boring. Thanks for that!

JR: On your blog, The Bear Den, you talk a lot about cooking. Does your programming experience influence your cooking style?

BB: Well, when people ask me for a recipe, I give it to them in XML. Does that count?

JR: Can you think about a case when your cooking experience influenced your programming?

BB: Splashing tomato sauce into the keyboard definitely has an effect.

Seriously, I think that one of the reasons that I like cooking so much (besides because I like to eat) is that it's so completely different from programming. While I feel that programming is as creative as it is an analytical endeavor (at least for me), the sort of creativity that goes into cooking is of a different sort. Besides, my other hobbies are digital photography and videography; both if which involve being plopped in front of a computer. Cooking is the one interest I have that doesn't involve a keyboard.

Unless you count using the iMac in my kitchen to look up recipes, or enter them into a database.

JR: You have an iMac in your kitchen?

BB: Of course, to look up recipes, surf while waiting for a sauce to reduce, stream iTunes from my upstairs PowerMac, and moderate JavaRanch first thing in the morning while my coffee brews. Don't you?

JR: Explain the motorcycle in exactly 42 words.

BB: Riding a motorcycle is as close as you can get to flying while still keeping two wheels to the ground, riding with the wind in my hair. OK, I have no hair and I always wear a helmet, but you get the idea.

JR: That was 43 words.

BB: Bill me for the extra word. Make it the I, that's probably the cheapest.

JR: What's your favorite felony?

BB: Hmm, according to Wikipedia, crimes commonly considered to be felonies include: aggravated assault and/or battery, arson, burglary, embezzlement, grand theft, treason, espionage, racketeering, robbery, murder, rape, kidnapping and fraud.

BB: None of those really suit my style. Can't we stick with misdemeanors?

JR: No.

BB: Dang. Then I'd have to pick espionage. Except that I'd be a double agent! That way, I could still be the good guy and Matt Damon would play me in the movie version. Though they'd probably have to hold him down while they shaved his head.

JR: What would you most like to say in Russian?

BB: "Just show me the way to the blasted bathroom!"

JR: You've done three big projects with Manning. After all the work, does Manning feel more like a Mother or a Father to you?

BB: Neither actually. But the Publisher, Marjan Bace, often likes to chat with the authors by phone. These conversations are always engaging and thought-provoking, but somehow, I always feel like I'm being sent to the Principal's Office when one is scheduled.

JR: Did you get sent to the Principal's Office a lot when you were in school?

BB: Hardly ever! I was a complete goody-two-shoes! I didn't develop my bad boy image until... wait, I never did develop a bad boy image. I'd better get to work on that...