Offline runnable Thesaurus Training Web App – JavaScript

JavaScript is the peace of cake I avoided to eat for so much time. I often had to do with web development, but learning JavaScript to get a few tricks done? But nowadays as I want to get serious with web development, there is no way around deep knowledge of JavaScript. We live in a time of single page apps written entirely in JavaScript, talking with the backend via REST services. That’s why AngularJs is so popular. How to learn JavaScript to program the offline runnable thesaurus training web app?

Beginning JavaScript Development with DOM Scripting and Ajax

For me the first step was to read Christian Heilmanns Beginning JavaScript Development with DOM Scripting and Ajax. The focus of this book is to write unobtrusive JavaScript. Unobtrusive JavaScript leads to Progressive Enhancement. According to Heilmann JavaScript is meant to enhance web pages but pages should not depend on it. It is clearly an annoying show stopper if some small JavaScript code will break the whole process to order the tickets for the flight into the next holidays. Instead JavaScript should just enhance a web page. This is practiced by first testing if the browser supports the desired feature. This is another good habit Heilmann teaches, to test for functionality rather than to test for browser vendors or versions. And the book teaches to depend on standards and go the mainstream way. There are several good reasons for progressive enhancement. Users that turned off JavaScript deliberately or under constraint are able to use the website. But that is just the obvious effect. Search engines can index the website. Nowadays I’ve heard that Google interprets JavaScript anyways. But I have to read more about this. But search engines will be deeply grateful that they get content without much fight. Accessibility is another reason to enhance a website instead of generating it by JavaScript. If content or navigation is generated, screen readers might not be able to read it. These are all the concepts that are applied throughout the whole book when Christian explains how to use modern JavaScript to change the DOM, change the presentation layer via CSS, handle images and windows, enhance navigation and forms, interact with the backend via Ajax, validate user input, use third party libraries and debug scripts. Heilmann often mentions the historical background of several techniques that evolved in the JavaScript field. That means, it is not just a technical book that teaches, what can be done but also what is the best way to do something. I like such kind of books where a very experienced mentor is sitting beside you and helps you around the pitfalls. My copy is the first edition from 2006. But the current edition has not changed much. I compared my edition with a PDF of the new one and did not find big differences. I don’t believe that it’s due to the authors laziness. This book does not discuss the hottest news but how to write modern JavaScript and apply good concepts and obviously this hasn’t changed the last years very much.

What Heilmanns book does not deal with is structuring a large code base. Maybe this is generally contrary to the concept to use JavaScript to enhance a web site? Heilmann explains the JavaScript object notation to avoid global variables that collide with variables of other scripts and creates chaos. But he does not explain the module pattern, how to hide information in private variables or methods, closures and all things that make JavaScript a great language.

For getting a deep knowledge of the JavaScript language itself, Douglas Crockford is your man. I watched some videos on youtube where Crockford explains the bad and the good parts of JavaScript and how to avoid the bad and how to concentrate on the good parts. You can buy his book JavaScript: The Good Parts and his book is also available for free. I have not read this one yet.