rank trend

Pro JavaScript Techniques (Pro)

by John Resig
Released 2006-12-11
Read articles about Javascript
Buy it from AmazonNew for $29.69

21 Reviews

Sort by: Most Helpful ▲ Date Rating

5 stars A great book -- but not for all.

2007-03-19     32 of 33 found this review helpful

§
"Pro JavaScript Techniques" is definitely for experienced and advanced scripters. The level of abstraction is high in this treatment of the latest trends of JavaScript. If you are looking for ready-made scripts to solve some specific problem in your site or application, you are looking for a different sort of book.

If you have ever gone to Douglas Crockford's site to learn about advanced concepts in JavaScript, and withdrew dazed and abused by his obtuse examples -- but with a conviction that there was something valuable to learn there -- this book is for you.

The author states, and I agree, that understanding Chapter 2, "Object Oriented JavaScript" is the key to the puzzle. "The phrase object-oriented JavaScript is somewhat redundant, as the JavaScript language is completely object-oriented and is impossible to use otherwise. However, a common shortcoming of most new programmers is to write their code functionally without any context or grouping."

The chapter contains a clear exposition of what the author means by "context or grouping." In fact, his concise but relevant example code to explain the distinction between privileged methods and static methods lit up all sorts of light bulbs in my head...Finally! :-)

Be aware that the author's approach has a particular bias in that it is often directed at the *programmer* coming into Web scripting. The idea is to make the JavaScripting world appear more like the programming languages already known. You learn "how to go about writing a variety of object-oriented code to suit anyone coming from another programming language."

This is a great book -- but not for all.
§

5 stars excellent for the at least moderately experienced

2007-01-28     21 of 21 found this review helpful

As a javascript dabbler, I was looking for a book aimed at someone already familiar with javascript and found this one. Having read a few apress books, I felt pretty confident that the quality of this one would be at least reasonable and I definitely wasn't let down.

The executive overview is that this is an excellent book for those who are already working in javascript and are looking to improve their game. It covers a world of techniques very well. Highly recommended.

Now, the longer review...

This is an excellent book that deftly avoids the pitfalls so many books that claim to be aimed at people familiar with the topic. So many of these types of books try to be accessible they end up giving a lot of basic information mixed in with the advanced information - ultimately becoming a text unsatisfying for people of any level. This book devotes the beginning 15% of pages going over the basics, but it covers a ton of ground by acting more as a refresher course - assuming at least basic familiarity with most of the topics. I think it really did a great job of this, starting in Chapter 1 with a broad overview of OO javascript, cross browser issues, being serious and rigorous with your development process and their particular views on how to deploy javascript unobtrusively.

The subsequent 3 chapters are the refresher course. These chapters work through a ton of topics, at times it refers you to sites on the net for further information. He starts the overview with pretty much every topic in OO development, from scope and closures to a remarkably sweet and concise description of context. He brings together all these topics and how together they form the building blocks for javascripts particular flavor of OO. Then he tackles the various ways to deal with inheritance - here he covers ways to do it yourself as well as a couple libraries that you can use. He also talks about packaging and ways to make your code play well with others. He wraps up the overview with a chapter about debugging and testing - a topic I think a bit under-discuessed in javascript and I was happy to get his views and suggestions on how to deal with these.

With those conveniently out of the way he dives right into several chapters where he talks about the DOM, events and css scripting and how they relate to his goal of creating unobtrusive scripts where no javascript intrudes on nice clean html. He covers these topics by presenting a small problem and working through the code to solve that problem. It's very easy to follow and works well. He introduces several libraries to help with the process, but is careful always to explain the fundamentals of how things are actually working under the hood. Too many books that start working with libraries gloss over what's actually happening and wind up being little more than extra documentation for the libraries, fortunately this book doesn't suffer from this problem.

He then goes into two more chapters bringing it all together with larger in depth projects, enhancing forms with validation and other features as well as a javascript image gallery.

The last major part covers Ajax - one chapter goes into nice detail and builds several helpful library functions. He also covers handling the return of these requests and the pros/cons of xml vs html vs json. And then it goes into two bigger projects enhanced blogs, autocomplete and wiki.

Finally, he talks a little about where javascripts going and provides some references for DOM, events and browsers in the appendix.

There's not much negative to say about this. It gives a great overview for those who don't know the language inside and out, it covers a huge number of topics in a very readable and instructive way and gives a very useful reference to DOM and event scripting at the end. It does suffer slightly from putting some code in that is unexplained until a future point in the book. But, it doesn't happen often.

5 stars Be a Pro JavaScripter in no time!!!

2007-05-28     18 of 19 found this review helpful

In the days of Ajax, a good understanding of JavaScript is crucial in really understanding how Ajax works. This book by John Resig (developer of JQuery) has written an intermediate - advanced book on JavaScript teaching the reader topics such as object-oriented practices, creating reusable code, DOM, events along with many useable examples. With all the fancy JavaScript libraries out now, it is good to have a book that teaches the reader how to create your own libraries or at least how many of those are create with proper object-based development.

Until Ajax came along (which brought about JS libraries), knowing how to create objects and reusable code wasn't really explained much in books. This book talks about it in the first chapter, where John shows how to create objects via Prototyping, function overloading and using the Object constructor. John also talks about closures, scope, property and method creation and namespacing. All of these topics are found in other languages (C++, Java, VB.NET), but were not really used much in JavaScript until recently. John also covers in detail inheritance (classical and prototypal) and goes through other libraries (YUI, Dojo, Prototype, etc) and how they are created. A very thorough explanation on objects and creating reusable code in JavaScript. Actually this is one of the few books that have covered these topics in such detail. Many other books just skimmed the surface with these topics that made it hard for the newbie to understand.

What current JavaScript book could be published without talking about the DOM. Every book nowadays talks about this topic since everything out on the web seems to use it in on form or another. This book goes in to great detail talking about the DOM with a complete explanation of the basics of what it is, when it can be accessed (waiting for the DOM to load), finding elements on a page, standard DOM methods and 3rd party functions that have been used for years to fill in the gaps of DOM methods that are not available. For instance: addEvent, getElementsByClassName, CSSQuery, JQuery and others. Without a solid foundation of the DOM, many of the cool things that are done on the web today could not be done.

Another important and often not talked about topic is event registration. Chapter 6 of this book goes into the various ways and element can respond to an event. From event phases, (capturing and bubbling), traditional event binding (DOM Level 1) to W3C DOM Binding. This can be a very difficult topic to understand since there are a few differences between the way IE and other browsers handle it. But John explains each difference in great detail and makes you fully aware of how to handle it with some nice examples.

John also covers creating unobtrusive scripts which doesn't assume that JavaScript will be available in the user's browser and how to handle this scenario. This also ties in to separating the three layers (Presentation, Structure and Behavior) which is also discussed. This teaches the user how to keep your inline JS event handling out of the HTML and in a separate .JS file. This makes updating your code easier and less problematic in the future.

The rest of the book focuses on using JavaScript with CSS and applying the previous techniques covered in useful examples such as form validation, creating a dynamic image gallery and some simple Ajax examples.

This is a great book if you know the basics of JavaScript and want to take your skills to the next level and especially if you're not a "true" programming and need a little more explanation. A great book!

5 stars Must-Read for Professionals

2007-04-05     9 of 9 found this review helpful

I an avid user of the concise JavaScript library jQuery. Though I am not a Star Trek fan at all, I like to think of jQuery as a universal translator of sorts. As long as I can intelligibly express in logical JavaScript syntax what I want to happen, jQuery does the heavy lifting, making it work in multiple browsers on differing operating systems, and it is all done unobtrusively. Needless to say, when I heard of the jQuery author writing a book, I was eager to read it.

I have just finished Pro JavaScript Techniques, penned by John Resig and tech-reviewed by Dan Webb. Let me just say that this book does not disappoint. This book takes a straightforward approach, and presupposes a fair amount of familiarity with JavaScript. It does not re-hash the history of the language as with many beginner books, and instead gets right into the fray. It picks up where its Apress predecessor Beginning JavaScript left off.

I appreciated that while this book could have easily been used as a selfish proclamational platform for jQuery, Resig took the high road and presented in-depth examples of writing complex DOM scripting. He also touches on other popular JS frameworks: Dojo, Moo.fx, Script.aculo.us and Prototype.

He also gets into the principles behind writing object-oriented code and optimizing it for reusability and avoiding of namespace collisions, when working alongside other developers. He then covers how to make the best use of Ajax, and the implications behind accessibility and need for a fall-back plan.

One of the serendipitous moments for me was seeing the name of a former coworker, Godbit contributor Cody Lindley. He was mentioned for his work on ThickBox, an in-browser modal window popup which can be used for image galleries and Ajax content. It runs atop the jQuery library, and I had the privilege of making the animated loading icon for it.

As the book's byline touts, this is a book full of real-world scenarios. As such, there are several code-complete examples: basic animations, form validation, infinitely scrolling WordPress blog archive, image gallery, auto-complete search, and an Ajax wiki. The last section covers what's on the JavaScript horizon: version 1.6, 1.7, Web Applications 1.0 recommendation, and the canvas tag.

There are also three appendices which are well worth reading, a DOM reference, Events reference and modern browser overview. When it's all said and done, this book is one that no scripting pro should be without. I am already eagerly awaiting Resig's next printed endeavor, the definitive jQuery Book.

5 stars Take your understanding of Javascript to the next level

2007-02-22     9 of 9 found this review helpful

Pro Javascript Techniques by John Resig was a very in depth look at Javascript and its capabilities. I loved this book for the simple fact that the first chapter started by introducing you to objects in Javascript. No time was wasted on the basics, you were diving in deep right from the beginning. Also, even though John is the creator and lead developer of the jQuery Javascript library, this book was not about pushing his framework. He did a great job of introducing many of the different frameworks and listing their strengths and purposes.

The entire book had you building a library of usable scripts that allow for great portability while using Javascript in your applications (or even your personal website). Each chapter discussed the scripts, their functionality, their support, and giving great details to how they worked. Most chapters also gave you examples of the scripts in a working environment. A quick breakdown looks like this:

The first part of the book discussed Object Oriented Javascript. This included information related to creating your own objects and extending the core javascript objects. He then moved on to discussing testing of your code and how to package it for distribution. This is especially helpful for those working in an environment with multiple developers/programmers. Thankfully, he discussed unobtrusive DOM scripting, which still may be new to some developers. The first part closed with discussions related to AJAX and browser support, both of which we would see more of later. All of part one was a brief introduction to what we would read through the rest of the book

Part two discussed Object Orient Javascript in more detail. This included things such as basics of objects, object creation, references, overloading, scope, and closures. I found this chapter to provide a solid foundation for the rest of the chapters to come, as well as very descriptive related to objects. The next few chapters discussed creating reusable code and shined some light on several of the libraries available. Also, we got a glimpse into the wonderful world of debugging javascript and were introduced to some great tools to help you as you build.

Part three dives into unobtrusive Javascript and intricate details related to the DOM and how to manipulate the DOM. Once we learn how to properly manipulate and traverse the DOM, we move on to attaching events to elements. All of this was discussed in light of progressive enhancement and making sure content is always available. The last three chapters of this section discussed Javascript and CSS, how to improve forms (which is also a topic for another discussion), and a practical example of building an image gallery.

Part four pushes ahead to AJAX. The first chapters discussed the history of AJAX and some of its common uses. With a foundation of understanding what AJAX is, the next chapters were spent with practical examples of enhancing your blog (quick access to all posts dynamically on scroll), building an autocomplete search field, and creating an AJAX Wiki. I found that the blog and autocomplete were a little more valuable than the Wiki.
The final part looks to the future of Javascript. This section was very educational as we move forward. This is very important to be aware of what will be available in the near (hopefully) future.

The appendixes were extremely valuable, and I will use it as a quick reference as I begin developing more Javascript. A full listing of the DOM reference, Events reference, and the Browsers.

Overall, this book was an incredible read and is highly recommended for those who want to take their Javascript skills to the next level.

5 stars Ready for Level 2?

2008-01-19     8 of 8 found this review helpful

After writing disorganized (yet effective) JavaScript functions for seven years, I really wanted to get more out of the language. I wanted to code more efficiently. As each new project started, I found myself scurrying to find old functions strewn across different computers or servers. Even when I found this code, I would often need to make some significant changes to it.

So, I did what any self-taught front-end developer would do: I hit the online tutorials. Online tutorials didn't really do it for me, though. The good tutorials seemed too short, and I kept reverting back to sloppy coding after a few days.

Then I came across this book.

The examples are excellent in demonstrating how the language can really work for you if you're willing to put the time into it. That being said, this book is not for beginners. This book is probably best for three groups of people:

1) Intermediate JavaScript developers who are ready to finally adopt code reuse and reap the nice things a loosely typed, object-based language can give you.

2) Java/C++ programmers who need to pick up JavaScript for a project. These people are already familiar with OO concepts and will probably have an easier time learning the language from a book like this.

3) Ambitious beginners with a lot of patience.

After only 3 chapters, I started to think about JavaScript in a different way. For the first time ever, I found myself reusing code with little to no change required. My code was easier to read, too.

I'm a big proponent of activities that give back the time you invest. Bad books don't do this. Good ones, like this book, do.

3 stars breadth but no Depth

2008-02-25     7 of 9 found this review helpful

Book has lots of examples. Many involve using libraries such as Prototype and JQuery. But, if you are not already familiar with using those libraries, the examples will not make much sense. And considering the typos in the straight JavaScript examples, it left me wondering about the validity of the library demos. Written in the style of a blogger where the author expects you to follow a link to a library's web page and then come back before you can understand the example. If I'm paying for a book to cuddle up with to read on a winter's night, I want it to be self contained - and not expect me to reach for the laptop to read up on the syntax of another library. It also didn't even touch upon one of the more difficult to grasp "Pro" techniques - scoping of "this" when using object methods during AJAX callbacks in the author's own code examples or the various libraries he touts.

5 stars keyword here is clean

2007-03-14     6 of 7 found this review helpful

As an experienced programmer, you need learn JavaScript to do real life Ajax project. So you learnt the syntax and started to code. But you are struggling to keep all your good coding practices in JS, then this book is perfect for you.

It covers lots of ground, OO, packaging, testing, design and some very important but tricky basic like DOM, Event, CSS and Form validation. John covered them in an incredibly clean way with great example and explanation. Keyword here is CLEAN.

Arguably the best advanced JS book on the market. Thanks John!

1 stars Once good, now outdated

2008-03-22     5 of 21 found this review helpful

This was an excellent book two years ago, (and still is), but it's now outdated. I bought it based on its nearly five-star rating; I wish I'd done my homework, since I immediately needed to buy other books to supplement this one.

5 stars John Resig is brilliant and so is Pro JavaScript Techniques

2007-10-25     5 of 5 found this review helpful

Let me begin this review by mentioning, I've never had the desire to write a review for any of my 100+ owned technical literature pieces. John Resig's
Pro JavaScript Techniques (Pro) has inspired me to login and give three thumbs up for this phenomenal book.

Getting into John Resig's brain, author of the innovative library jQuery (www.jquery.com), has been nothing short of an exciting ride. The author makes Object Orientated JavaScript surprisingly simple to understand, as well as thorough understanding of the DOM, Events models, Ajax and many other contemporary styles of JavaScript as its written by professionals today.

I no longer reference any of my other JavaScript books. Instead opening up John's piece proves valuable over and over when in need of a refresher or a utility function for my web applications.

For any web developer who's serious about writing clean, powerful, unobtrusive JavaScript code -- look no further than John Resig's Pro JavaScript Techniques.

4 stars Good Book

2007-06-04     4 of 6 found this review helpful

A decent book. If you have all the basics of javascript down and want to expand on that knowledge this a good selection. I found the sections on unobtrusive javascript very good. The most complex part of a javascript application can be witting it so that it work in all browsers. This can force one to write a ton of code just to deal with different browser implementations. I found Dean Edwards event loader to be an awesome piece of code which I believe I will use regularly in the future.

I did find a few errors in the code printed in the book. On page 231 the ajax function should read:


window.onload = function(){
ajax({
url: "scores.html",
type:"POST", /*this is listed as html in the book which is wrong*/
....


I saw a few little mistakes like this in the code in the book which indicates that it was rushed a bit. Obviously the author knows his stuff. Overall good book.

5 stars Excellent

2007-03-20     4 of 6 found this review helpful

I used to think I was an intermediate javascript programmer. After reading this book I realized there is so much to JavaScript. You can definitely put me in the beginner category now. The stuff I did was so basic. This book opened my eyes to a whole new world of javascript!

4 stars Finally, a JavaScript resource aimed at me

2008-04-30     3 of 3 found this review helpful

Pro JavaScript Techniques by John Resig is probably the best resource on the language I've encountered to date. I'm one of those web developers who has had something of a mental block when it comes to JavaScript. Despite its ubiquity, it always seemed like a toy language to me. It didn't help that JavaScript's syntax plays a bit fast and loose to my tastes, and that virtually all of the other resources on the language I've encountered barely scratched the surface on what the language can actually do. If you're like me - familiar with the basics, but knowing that you're not proficient enough to use it in a professional setting - then this book is for you.

First, the bad news. Like all aPress books I've encountered, this one suffers from a few small, but glaring, editing errors. Small things - variable names that change between examples for no good reason, in-text refrences to things the author didn't mention (no doubt something missed between drafts), that sort of thing - crop up. It's not enough to break the book, but it is annoying.

Also, the first section of the book moves at break-neck speed. While some of it is review, for those of us who have been toiling in web tutorials and older books, a few re-reads are necessary to truly understand what's going on. Thankfully, Resig addresses things in a logical manner, so each topic flows nicely into the next, making returning to those parts as painless as possible.

Finally, in the chapter where he discusses public, private, and privledged object properties and methods, he completely glosses over how private properties and methods function. Instead, he merely tells the user to visit Douglas Crockford's site on the matter. It's a bit of a cop-out, and I figure that since I'm spending ~$30 on the book, the least he can do is briefly condence Crockford's ideas.

All that said, though, the positives outweigh the negatives by far.

Despite the quick pacing of the book, the information (ignoring editing inconsistencies) is delivered in a straightforward manner. Resig addresses most, if not all, of those little things which are important in the real world (testing/debugging, how to work with libraries, how to ensure your code doesn't interfere with someone else's code, etc), but are often ignored in other resources.

In particular, the early chapters (chapters 2 and 3) on dealing with JavaScript objects are well done. While Resig doesn't go into all of the details (most notably with the link to Crockford's site I mentioned earlier), these chapters form the foundation of just about everything you'd want to do with the language. Indeed, these chapters address most of the pitfalls that create those pesky JavaScript errors we've all dealt with before: scope, closures, and context. Understanding how those three concepts work in unison is fundamental towards understanding modern, professional JavaScript as a whole.

Being a JavaScript book, this particular volume visits topics we're most likely all familiar with: DOM scripting, event handling, and even a bit of AJAX. Thanfully, Resig stays true to his mission of creating inobtrusive JavaScript, and keeps his HTML separated from the scripting code. This is a far cry from other self-proclaimed professional tomes that embed their JavaScript function calls within their HTML tags.

To conclude (and reiterate), Pro JavaScript Techniques is the perfect book for those developers caught in the middle. It's a resource aimed at those of us who have had experience with the language, but have never been pointed in the right direction to use it in a professional manner. Despite its annoying flaws, this book fills the rather large gap between beginner's JavaScripting and creating robust AJAX applications. It's worth owning if you ever want to do serious work with the language.

2 stars If you can debug the code, you don't need the book

2008-08-25     1 of 1 found this review helpful

I agree with only one other reviewer who commented on the typos, etc. The demo code does not work until you debug it. The first couple of chapters on Javascript code are very good. The chapters on Forms (8) and Lightbox(9) are so poor I stopped reading. I am a jQuery user and admire Resig's contribution, but this book should be skipped.

4 stars Not bad, but some annoying points.

2007-08-14     1 of 11 found this review helpful

This book is not too bad as far as it goes, but the layout of the book does not lead to a natural understanding of the subject matter. This book is a nice adjunct to more comprehensive works.

One very annoying point is the way the author continually uses the phrase "A couple ..." as in "A couple things". The phrae is "A couple OF things" not a "A couple things". I know this is a small thing, but it is repeated over an over in this book, and it becomes quite annoying.

I would still recommend this book, but please fix your idiomatic expressions in future works.

4 stars Doc from the Crock

2008-10-24     0 of 0 found this review helpful

Lots of direct advice from one of the JavaScript masters. I found it illuminating and easy to read. Not for beginners or casual users of JavaScript.

Several constructs and techniques are clarified. Several ideas new to me were introduced. I can see improving the robustness of my code, and reducing its complexity, with some of the author's suggestions.

I would recommend this to any serious JavaScript developer.

The author has several YouTube and Yahoo Videos online. You may want to look at these also to see his style of presenting information.

4 stars Don't waste anymore time thinking, just get this book!

2008-10-11     0 of 0 found this review helpful

The best JS book I've ever read. Perfect for back-end developers who have to also spend a lot of time on the front-end working with JS/CSS. This book will take you from being an intermediate JS developer to an advanced level, clarifying several fundamental concepts (OOJS, basic patterns) as well as showing you the nice clean way of performing several tasks (designing forms, client-side field validation).

5 stars Excellent work!

2008-06-27     0 of 0 found this review helpful

John Resig never fails to amaze and his latest book is no exception. I highly recommend it to everyone interested in javascript; it is a must have.

4 stars If you want to know the next step

2008-02-15     0 of 2 found this review helpful

If you are an intermediate javascript developer, and you want to know what to learn next in the javascript language this book is for you. Inside you will find concise information about several obscure javascript elements which will make your coding more effective once you master them.

5 stars Pro Javascript - the title says it all

2007-12-31     0 of 1 found this review helpful

How refreshing to finally get a book written by a pro for pros, one that does not spend the first half trying to teach one how to program. Instead, it is assumed you know your stuff, know languages in general, but need a deep reference for what makes Javascript different, and where its power lies. Even the introduction taught me stuff I needed to know, about Javascript, and not about how to write a program.

If you are an experienced pro, but in classical languages (C/C++/C# etc), but are moving into AJAX, this is the book to get. And use Firebug in Firefox to follow along. The debug environment that provides is an eye-opener in itself.

5 stars very well written

2007-07-27     0 of 4 found this review helpful

This book will surely take your javascript skills to the next level. Every chapter is worth reading.

Buy it from AmazonNew for $29.69