Book Review: Sams JavaScript

Posted: August 07, 2006 Comments(4)

If you haven’t ever come across any of the books in the Sams Teach Yourself <Insert Technology> in 24 Hours, the idea behind them is this: Each chapter can be read in one hour, and there are 24 chapters in the book. Therefore you can theoretically complete the book in a total of 24 hours. While some people may be misled into thinking that they’ll learn what they want in a day, it’s really just a clever gimmick — and for the most part, it works.

In reality, I’ve become a bit of a fan of this technique. Much of the writing style revolves around the idea that each chapter should be taken one hour at a time, and breaks can be taken whenever you need to. More often than not, the chapters don’t take an entire hour and you can complete the book in much less time than 24 hours total.

Teach Yourself JavaScript in 24 Hours

I’ve just completed Sams Teach Yourself JavaScript in 24 Hours 4th Ed. [TYJS].

Sams Teach Yourself JavaScript in 24 Hours

Naturally there were things I liked about the book and things I didn’t like so much. To be honest, the things that bothered me a bit were because I was being very picky about the subject.

Given the history of JavaScript, hearing it mentioned often sent a chill down my back. Fairly recently, the language has become more developed and standardized. JavaScript is being used much more as of late, but this time around, developers are writing smart, unobtrusive code that simply enhances the experience of users able to execute JavaScript.

Luckily, from the opening of Sams TYJS, caution is given towards writing code that is cross-browser and more importantly unobtrusive. I was impressed at the mention of such phrases as “graceful degradation” and “progressive enhancement”. I was also very impressed in regards to some of the detail the author touched upon when talking about common differences a developer will run into when testing on various browsers. The author also gives some good beginner tips to first time programmers when speaking about avoiding broswer-specifc code, writing good documentation, and taking usability and accessibility into account when writing scripts. Throughout the book the author mentions the benefits to separating the structure, presentation, and behavior of a document. It’s great to read these things in such books that are quite likely to be the first book a developer picks up.

JavaScript Techniques Mentioned in the Book

Naturally you would expect to see an abundance of examples in a book such as this, and there are. Here is where I began to see some weakness in the content of the book. At one point, the author suggests an interesting method of checking whether or not JavaScript is enabled for any particular user. His solution was to include a JavaScript file, that if executed, would take the user to the ‘JavaScript’ enabled page of the site. I’m not sure why the example was inserted, but I’m hoping it was the author playing Devil’s Advocate. In the next few sentences the author mentions Feature Sensing and refers to it as a more effective solution. Thank goodness.

I was also disappointed to see the introduction of CSS using a style block in the head of various examples. The author also mentioned inline styles as an effective way to single out an element for styling. I think more emphasis should have been placed on the benefits of using external style sheets to manage your presentation layer. The author did mention that keeping your style within the same document as your markup is difficult to manage and cause the document to become lengthy and confusing, but it seemed to be mentioned in passing.

Chapter Hopping

As I had said earlier, Sams has an interesting gimmick with their writing style. Separating the chapters into ‘hours’ for easy management can be quite a help to a reader. One recurring pattern throughout the book was constant referral to future chapters. I think to a new reader this would confuse them quite a bit. At some points it seemed as though the future chapters were mentioned just to include a piece of jargon in the text. I assume this is done not only to encourage the reader to continue to the next chapters, it may also be done to conquer any questions the reader might have from possibly hearing these terms before reading the book.

Closing Things Up

All in all, I enjoyed reading Sams Teach Yourself JavaScript in 24 Hours and I would recommend it to someone looking for a solid introduction to JavaScript. The author gives solid examples of DOM manipulation and constantly mentions positive coding practices. I think it would be a great start for someone interested in picking up JavaScript. The W3C and their efforts of standardization are mentioned and supported in the book which I think is great — anyone entering the world of Web development should be very aware of the W3C and all they’re doing.

It’s also great that the author gives insight as to some of the specific tools available for JavaScript development. Such detail is given as the Firefox JavaScript console, DOM Inspector, Chris Pederick’s Web Developer Extension, Greasemonkey for writing user scripts, and other tools for Internet Explorer such as the Developer Toolbar.

In the end, I would have to give Sams Teach Yourself JavaScript in 24 Hours 4th Ed. my stamp of approval. It’s an easy read, at an affordable price, and will give any beginner a solid introduction to working with JavaScript.

Get my newsletter

Receive periodic updates right in the mail!
  • This field is for validation purposes and should be left unchanged.

Comments

  1. I have this book, and it is indeed a solid introduction to working with Javascript.

    It doesn’t show any tricks or hacks when using Javascript, which is sometimes required since every browser interprets it slightly differently. It would have been nice to have a browser specific issues chapter.

  2. @Oliver: That’s a good point indeed. From time to time the book did bring up the various quirks between browsers (mostly the issues with IE), but the examples were pretty basic so coming across anything major wasn’t too common.

    I think they tried to keep this book as a basic introduction to JavaScript and give hints towards what to expect should you pick up an advanced book sometime in the future.

    Thanks a lot for stopping by!

  3. […] JavaScript methodologies have come such a long way, and there are many ways to ensure that your scripts gracefully degrade. There have been entire books written on the subject that offer completely great advice that should be taken into consideration by any Web designer/developer. Each case will be different in appropriate alternate content to provide, and some thought should be put into each one. If JavaScript isn’t completely essential, don’t tell your user that the page requires JavaScript. Re-examine what the page is doing and compensate if you need to. Just because AJAX (yes, real AJAX) is the latest buzzword doesn’t mean you should break things just to say you use it. […]

Leave a Reply

Your email address will not be published.