Book Review -- JavaScript: the Definitive Guide, 6th Edition
Michael J. Ross writes "Released during the early days of the Web, in 1995, JavaScript has come a long way: Initially a client-side scripting language typically (mis)used for decorative effects, it is now an essential part of countless major websites. Its increasing capabilities and popularity are due to several factors, including the development of libraries that resolve earlier stumbling blocks that held the language back (such as inconsistencies among the implementations in different vendors' browsers). JavaScript: The Definitive Guide, authored by David Flanagan, was first published just one year later, in 1996, with several significant updates made since then."
Read below for the rest of Michael's review
JavaScript: The Definitive Guide, 6th Edition
author
David Flanagan
pages
1100 pages
publisher
O'Reilly Media
rating
9/10
reviewer
Michael J. Ross
ISBN
978-0596805524
summary
The most comprehensive treatment of JavaScript yet published.
The book is now in its sixth edition, under the ISBN 978-0596805524, and was published on 10 May 2011 by O'Reilly Media (who kindly provided me with a review copy). At 1100 pages, it certainly feels heavier than its advertised 2.6 pounds — but that may only be a side effect of the thought of wading through over a thousand pages of technical explanations and example code. Yet one could argue that the size is justified, considering the amount of information the book conveys, and its obvious aim to be a comprehensive treatment of the language. The material is organized into four parts, including 22 chapters. On the publisher's Web page, visitors will find a brief description, the complete table of contents, a few consumer reviews, reported errata (seven as of this writing, and none confirmed), the example code used in the book, some free content (the first chapter), and links to purchase the print and e-book versions.
The book commences with a multipart introduction, which begins with the sentence "JavaScript is the programming language of the Web." Even though that statement is not true — since there are many other Web programming languages — it does hint at the importance of the language in the mind of the author, and his willingness to put so much effort into creating such a detailed monograph. The introduction is also the first point in the book where one sees the clear demarcation made by the author between core JavaScript (i.e., the language definition, regardless of its runtime environment) and client-side JavaScript (i.e., usage of the language within Web browsers, including the use of libraries). Both areas are covered in great detail in the first two parts of the book, in quasi-tutorial format, while the last two parts cover the same areas, but in a purely reference format.
Specifically, the first part of the book, "Core JavaScript," offers almost a dozen chapters that explicate the basics of the language: its lexical structure; types, values, and variables; expressions and operators; statements; objects; arrays; functions; classes and modules; regular expressions; JavaScript subsets and extensions; and server-side JavaScript. At almost 300 pages, this part alone could form its own volume. The manner in which the author dives into the technical details, and the amount of example code, immediately make it evident that the book is intended for readers who have experience programming, although not necessarily in JavaScript. In fact, some readers — especially newbie programmers — may become frustrated with those places in the narrative where the explanation is not entirely clear. For instance, on page 7, the "points array from above" refers not to any code on that page, but instead refers to an array defined two pages earlier. Fortunately, such stumbling blocks are infrequent. For experienced JavaScript programmers, these chapters could provide a comprehensive review. For readers new to JavaScript, the material may seem overly dry, but the illustrative code should be quite helpful.
The ten chapters that compose the second part of the book, "Client-Side JavaScript," show how to work with the language within a Web browser. This includes learning how to embed JavaScript code in HTML files; differences among browsers and the versions thereof; the security of JavaScript code; the Window object; how to access and manage the elements within the Document Object Model (DOM); scripting CSS styles; events, and methods of handling them; scripting HTTP, and its use in Ajax (reflected in this edition's subtitle, "Activate Your Web Pages"); the jQuery library; techniques for storing data on the user's computer; how to use JavaScript to dynamically create and manipulate graphics, audio, and video content, as well as charts and drawings; and, lastly, the use of several HTML5 APIs. Speaking of that last topic, probably the most significant changes in this edition, versus the previous one, is the coverage of ECMAScript 5, as well as the new objects and methods introduced with HTML5. Naturally, some of these enhancements do not work in any version of Internet Explorer but the most recent, so the author discusses workarounds, if available.
As noted earlier, the third and fourth parts of the book constitute the purely reference material, with the first part focusing on core JavaScript, and the latter on the client-side aspects of the language. Every chapter is organized into a series of entries, each devoted to a particular class or object, ordered alphabetically. For each entry, the reader is given a brief synopsis, description, and in some cases example code and references to other entries. Each class entry also includes information on its properties and methods, where applicable. Each single method entry includes information on its arguments and any return value. The book concludes with what is arguably the longest and possibly most valuable index I have ever seen in a computer book.
There are only a few immediately-evident weaknesses of this book: Firstly, there are some phrases that may be clear to the author, but likely will prove baffling to the typical reader — e.g., "nonlinear cross-reference problem" (page 8) and "the jQuery gives a synopsis of each method" (page 523). Secondly, some of the example HTML code could have been written better, such as the use of an HTML table for defining the layout of a simple form, with labels and fields (page 13). Finally, despite the claims of the marketing copy that this title is suitable as both "an example-driven programmer's guide or a complete desk reference," it would serve better as the latter, and not as a tutorial for learning the language. Clearly, the more comfortable one feels with computer programming — especially JavaScript itself — the more that one could get out of this book.
On the other hand, there are far more pluses than minuses. One of the real strengths of the book is how the author does not hesitate to use (sometimes lengthy) blocks of code, with explanatory comments for almost every line, to clarify the language — as opposed to paragraphs of text, which could have easily doubled the length of the first two parts (which comprise roughly the first two thirds of the book). Also, in conjunction with the narrative and code fragments, the author makes effective use of figures whenever needed — particularly in Chapter 21, in demonstrating how to work with graphics and multimedia content.
Evolving with the language itself, and again brought up to date, JavaScript: The Definitive Guide still retains its crown as the ultimate reference resource for JavaScript programmers.
Michael J. Ross is a freelance website developer and writer.
You can purchase JavaScript: The Definitive Guide, 6th Edition from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
The book commences with a multipart introduction, which begins with the sentence "JavaScript is the programming language of the Web." Even though that statement is not true — since there are many other Web programming languages — it does hint at the importance of the language in the mind of the author, and his willingness to put so much effort into creating such a detailed monograph. The introduction is also the first point in the book where one sees the clear demarcation made by the author between core JavaScript (i.e., the language definition, regardless of its runtime environment) and client-side JavaScript (i.e., usage of the language within Web browsers, including the use of libraries). Both areas are covered in great detail in the first two parts of the book, in quasi-tutorial format, while the last two parts cover the same areas, but in a purely reference format.
Specifically, the first part of the book, "Core JavaScript," offers almost a dozen chapters that explicate the basics of the language: its lexical structure; types, values, and variables; expressions and operators; statements; objects; arrays; functions; classes and modules; regular expressions; JavaScript subsets and extensions; and server-side JavaScript. At almost 300 pages, this part alone could form its own volume. The manner in which the author dives into the technical details, and the amount of example code, immediately make it evident that the book is intended for readers who have experience programming, although not necessarily in JavaScript. In fact, some readers — especially newbie programmers — may become frustrated with those places in the narrative where the explanation is not entirely clear. For instance, on page 7, the "points array from above" refers not to any code on that page, but instead refers to an array defined two pages earlier. Fortunately, such stumbling blocks are infrequent. For experienced JavaScript programmers, these chapters could provide a comprehensive review. For readers new to JavaScript, the material may seem overly dry, but the illustrative code should be quite helpful.
The ten chapters that compose the second part of the book, "Client-Side JavaScript," show how to work with the language within a Web browser. This includes learning how to embed JavaScript code in HTML files; differences among browsers and the versions thereof; the security of JavaScript code; the Window object; how to access and manage the elements within the Document Object Model (DOM); scripting CSS styles; events, and methods of handling them; scripting HTTP, and its use in Ajax (reflected in this edition's subtitle, "Activate Your Web Pages"); the jQuery library; techniques for storing data on the user's computer; how to use JavaScript to dynamically create and manipulate graphics, audio, and video content, as well as charts and drawings; and, lastly, the use of several HTML5 APIs. Speaking of that last topic, probably the most significant changes in this edition, versus the previous one, is the coverage of ECMAScript 5, as well as the new objects and methods introduced with HTML5. Naturally, some of these enhancements do not work in any version of Internet Explorer but the most recent, so the author discusses workarounds, if available.
As noted earlier, the third and fourth parts of the book constitute the purely reference material, with the first part focusing on core JavaScript, and the latter on the client-side aspects of the language. Every chapter is organized into a series of entries, each devoted to a particular class or object, ordered alphabetically. For each entry, the reader is given a brief synopsis, description, and in some cases example code and references to other entries. Each class entry also includes information on its properties and methods, where applicable. Each single method entry includes information on its arguments and any return value. The book concludes with what is arguably the longest and possibly most valuable index I have ever seen in a computer book.
There are only a few immediately-evident weaknesses of this book: Firstly, there are some phrases that may be clear to the author, but likely will prove baffling to the typical reader — e.g., "nonlinear cross-reference problem" (page 8) and "the jQuery gives a synopsis of each method" (page 523). Secondly, some of the example HTML code could have been written better, such as the use of an HTML table for defining the layout of a simple form, with labels and fields (page 13). Finally, despite the claims of the marketing copy that this title is suitable as both "an example-driven programmer's guide or a complete desk reference," it would serve better as the latter, and not as a tutorial for learning the language. Clearly, the more comfortable one feels with computer programming — especially JavaScript itself — the more that one could get out of this book.
On the other hand, there are far more pluses than minuses. One of the real strengths of the book is how the author does not hesitate to use (sometimes lengthy) blocks of code, with explanatory comments for almost every line, to clarify the language — as opposed to paragraphs of text, which could have easily doubled the length of the first two parts (which comprise roughly the first two thirds of the book). Also, in conjunction with the narrative and code fragments, the author makes effective use of figures whenever needed — particularly in Chapter 21, in demonstrating how to work with graphics and multimedia content.
Evolving with the language itself, and again brought up to date, JavaScript: The Definitive Guide still retains its crown as the ultimate reference resource for JavaScript programmers.
Michael J. Ross is a freelance website developer and writer.
You can purchase JavaScript: The Definitive Guide, 6th Edition from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
If it's "The Definitive Guide", how can there be a 6th edition? I mean, a first edition would suffice if it was truly definitive...
Perhaps I'm trolling, perhaps I'm not.
In addition to jQuery coverage, does it also cover more mature, feature-rich, and better-architected JavaScript libraries like Dojo Toolkit (http://dojotoolkit.org/) or YUI (http://developer.yahoo.com/yui/), which should be used over the design travesty that is jQuery?
Also, for server-side JavaScript, which one does it cover?
It's sad how few web programmers have read this text. Don't be intimidated by its size, most of it is simply reference material, and not part of the tutorial chapters. If you read this book cover-to-cover (well, except for the hefty reference pages), you will be a JavaScript expert.
If you are a web programmer, and you can't answer any of the following questions, consider reading this book.
1.) What does the "new" keyword actually DO in javascript (hint: if you don't say about .prototype you are wrong).
2.) How would you implement a hash in Javascript? Related questions, how are Arrays and Objects different and similar? What is the shorthand notation for them? What does hasOwnProperty do? What is the difference between writing "obj.property" and "obj['property']", when "obj = {}" ?
3.) Explain how scope works in Javascript. How does this relate to closures?
Javascript gets a bad repuatation mostly because it is misunderstood.
Can someone write a computer book that doesn't either require weight training in order to hold the book (stuff your kindle up your ass I hate them), or six years to read? Most of the time the amount of useful information in these books only constitutes a small subset of the pages. Do these people think quantity makes quality? These authors should take a lesson from Kernighan and Ritchie.
-- I ignore anonymous replies to my comments and postings.
You have to deal with not just ECMA Script changing, but also the different implementations of it (JavaScript, JScipt, ActionScript, etc.) and then there's the issue of how it behaves in HTML3 vs. HTML4 vs. XHTML vs. HTML5.
I've got an older version, but there were a lot of useful sections about the dfferent implementations in each browser, and how to deal with something as simple as getting a script to fire before the user does stuff. (as Netscape and IE handled things differently, and for some things, you had to wait for the page to be rendered before you could modify it, etc.)
Much of that complexity's been dealt with by various JavaScript libraries, but then you have to explain what the ideosyncracies of the libraries are.
Build it, and they will come^Hplain.
"Initially a client-side scripting language typically (mis)used for decorative effects"
I remember using it back in the old days for client side input validations. As in the Pre-Ajax days if you were to submit a form and then get the page back with errors over a 14.4k modem took a while. Having Javascript as the first line of defense really help speed things up.
The visual effects were used as mostly toys to show off your skills as a web developer (back in the 90's if you were a good web developer that can do all sorts of gui you could make big bucks) Most serious sites kept that type of stuff down.
If something is so important that you feel the need to post it on the internet... It probably isn't that important.
I like the fact that the definitive guide is in its 6th edition. It's just like the Windows Ultimate Edition.. it won't need any updates or upgrades. Ever again. Or the movie Final Destination.. which got four sequels. Awesome.
- Henrik
- when the Shadows descend -
typically (mis)used
Oh, stuff it. Some day you purists will learn that the street finds its own uses for things, and that it's OK to do so.
...I'm getting off of it.
Seriously, you may have noticed that this is a book review targeted towards Javascript developers. The GP was discussing that topic to stimulate thought and conversation amongst like-minded individuals. Is that what you call "demonstrating smarts via elite knowledge"? Perhaps you're reacting negatively because you don't have adequate familiarity with the language. (Honestly, "tart up"?)
How's your buggy-whip business doing?
I only post comments when someone on the internet is wrong.
If you can believe this metric, http://trends.builtwith.com/javascript, jQuery is used in over 40% of the top websites. It has a strong developer community and is well-documented for the most part.
The book does not devote too many pages on jQuery, but it makes a few mentions.
Having a massive printed text like this is hardly useful compared to having it searchable and browsable online (or even offline).
Javascript is verbose, has annoying quirks and an ugly c-like syntax that hides the underlying elegance of its functional capabilities and object model.
But now we have Coffeescript, a source to source "transpiler" offering a beautiful, pleasant to write and read syntax inspired in Python and Ruby.
The more I play with it, the more I love it.
I agree that many languages and corporations overhype many langauge details as very important features, and that it is near impossible for outsiders to judge their importance.
But, certain language features are good for specific applications. Several lines of Perl could do in text processing, in what would take over a page of Java code. Text processing is a major use of computers. Web pages are another. While Javascript is not a completely horrible programming language, it is the exclusive programming language for client side web programming, one of the biggest uses of the computer today. The programming language for the prestigious job of client side web programming should be insanely great. Javascript is far from insanely great. Javascript is not worthy of its prestigious position. I hope it will be replaced by something that is.
All you mostly read about JavaScript is in the browser. There are however project that take JavaScript beyond the browser.
Are there any people who have experience with a project like Gluescript? It's on http://gluescript.sourceforge.net/ and it provides GUI programming, server side JavaScript, and maybe other things.
I just found out its existence today. Just wondering about opinions.
Well, don't worry about that. We can get you back before you leave. (Dr. Who)
"Secondly, some of the example HTML code could have been written better, such as the use of an HTML table for defining the layout of a simple form, with labels and fields (page 13)."
Doesn't this guy know you shouldn't use tables for layout?
While Javascript is not a completely horrible programming language, it is the exclusive programming language for client side web programming, one of the biggest uses of the computer today. The programming language for the prestigious job of client side web programming should be insanely great. Javascript is far from insanely great. Javascript is not worthy of its prestigious position. I hope it will be replaced by something that is.
I'm reading it right now on my Kindle, it's a fantastic introduction with a lot of code examples to experiment with.
"JavaScript: The Definitive Guide, 6th Edition"
You keep using the word `definitive.' I do not think it means what you think it means.
Not after six editions anyway...
I know David Flanagan when he was in Divine Inc.
Brilliant guy.
Slashdot = Sarcasm