It’s been a long time coming, but Professional JavaScript for Web Developers, Second Edition is now available! You can, of course, order it from Amazon if you’re so inclined, but you should also start seeing it show up in stores everywhere. I was informed at the beginning of this week that the book has started shipping from the warehouse, so if you go by a store and it’s not there yet, it will be soon!

You may be thinking, why should I buy this new edition? To answer that, I thought I’d share with you the foreword to the book, written by Eric Miraglia. Eric is the engineering manager for the YUI team and is a large reason why I joined Yahoo! over two years ago. A big thanks to Eric for this fantastic foreword.

Foreword – Professional JavaScript, Second Edition

JavaScript, for much of its existence, has been the subject of fear, invective, disdain, and misunderstanding. In its early years, many “serious programmers” thought that JavaScript wasn’t serious enough.

By contrast, many liberal arts majors drafted into web-developer service during the dotcom boom thought JavaScript was mysterious and arcane. Many who had both the tenacity and the patience to fully grok JavaScript as a language were nevertheless frustrated by its inconsistent implementation across competing browsers. All of these factors helped lead to a proliferation of awkward and poorly conceived scripts. And, through the extraordinary openness of front end code on the web, a lot of bad habits were copied from one site and pasted into the source of another. Thus JavaScript’s bad reputation as a language, which was generally ill-deserved, became intertwined with a deservedly bad reputation surrounding its implementations.

Around 2001 (with the release of Internet Explorer 6), improved browser implementations and improving practice in web development began to converge. The XMLHttpRequest object at the heart of Ajax was slowly being discovered, and a new paradigm of desktop-style user interaction was emerging within the browser. The DOM APIs that allowed JavaScript to manipulate the structure and content of web documents had solidified. CSS, for all the contortions, omissions, and the willful insanity of its implementations by browser vendors, had progressed far enough that beauty and responsiveness could be combined with the web’s new interactive power. As a result, JavaScript became the subject of a new set of emotions: surpise, delight, and awe. If you think back to the first time you used Google Maps in 2004, you may recall the feeling.

Google Maps was among an emerging class of applications that took browser-based programming as seriously as back end programming and made us think differently about the application canvas provided by the web browser. (Oddpost, which provided Outlook-style email functionality in a webmail client as early as 2003, was another notable pioneer.) The proliferation of these applications and the increasing market penetration of browsers that supported them led to a genuine renaissance in web application engineering. “Web 2.0″ was born, and Ajax became the “it” technology. The web was suddenly interesting all over again. JavaScript, as the only programming language of the web, became more interesting, too.

Interesting, but hard to do well. JavaScript and its companion APIs in the Document Object Model (DOM) and Browser Object Model (BOM) were inconsistently implemented, making cross-browser implementations vastly more difficult than they needed to be. The profession of front end engineering was still young. University curricula had not (and still have not) stepped in to meet the training challenge.

JavaScript, arguably the most important programming language in the world by the end of 2004, was not a first-class subject in the academic sense of the word. A new day was dawning on the web, and there was a serious question as to whether there would be enough knowledgeable, well informed engineers to meet the new challenges.

Many technical writers stepped in to fill the gap with books on JavaScript. There were dozens of these over the years, but by and large they were a disappointing lot. Some of them promoted techniques that were relevant only in retrograde browsers; some promoted techniques that were easy to cut-and-paste but hard to extend and maintain. Puzzlingly, many books on JavaScript seemed to be written by people who didn’t really like JavaScript, who didn’t think you should like it, and who weren’t optimistic about your ability to understand it fully.

One of the genuinely good books in the world of front end engineering arrived when Nicholas C. Zakas published the first edition of Professional JavaScript for Web Developers in 2005. At the time, my colleagues and I were working at Yahoo! to create the Yahoo! User Interface Library (YUI) as a foundation for front end engineering here and to evangelize best practices in our nascent discipline. Every Friday, we’d gather in a classroom to talk about the front end engineering and to teach classes on JavaScript, CSS, and the creation of web applications in the browser. We carefully reviewed the offerings at the time for books that would help new engineers learn how to build robust, standards-based, easy-to-maintain web applications using advanced JavaScript and DOM scripting. As soon as it was published, Zakas’s book became our textbook for JavaScript.

We’ve been using it ever since. We thought so highly of the book that we talked Zakas into coming to Yahoo! to help shape the front end engineering community here.

What Zakas accomplished with Professional JavaScript for Web Developers is singular: He treated JavaScript as a subject that is both serious and accessible. If you are a programmer, you will learn where JavaScript fits into the broader spectrum of languages and paradigms with which you’re familiar. You’ll learn how its system of inheritance and its intrinsic dynamism are, yes, unconventional but also liberating and powerful. You’ll learn to appreciate JavaScript as a language from a fellow programmer who respects it and understands it.

If you’re one of those liberal arts majors who was drawn into this profession in the boom years and never left, and if you want to fill in the gaps of your understanding of JavaScript, you’ll find Zakas to be the mentor you’ve always wanted—the one who will help you make the transition from “making things work” to “making things that work well.” He’ll leave you with a serious understanding of a serious subject. Best of all, you’ll find that he doesn’t pander to preconceived notions about how deeply you should understand the language. He takes it seriously, and in a patient, accessible way he helps you to do the same.

This second edition of Professional JavaScript for Web Developers—expanded, updated, improved—drops some subjects that are less relevant to the profession today and upgrades the rest with what we’ve learned between 2005 and 2008. These years have been important ones, and Zakas is on the front line of the process of learning. He’s spent those years architecting the current generation of the web’s most popular personal portal (My Yahoo!) and the next version of the web’s most visited site (Yahoo!’s front page). Insights forged in these complex, ultra-high-volume applications inform every page of this new volume, all passed through Zakas’s unique filter as a teacher/author.

As a result, his solutions go beyond being book-smart and include the kind of practical wisdom you can only get by living and breathing code on a daily basis.

And that’s seriously good news for the rest of us. Professional JavaScript for Web Developers is now even better, even more relevant, and even more important to have on your shelf.

Eric Miraglia, Ph.D.
Sr. Engineering Manager, Yahoo! User Interface Libarary (YUI)
Sunnyvale, California

Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.