Gerard Condon's Blog

Journal of a software developer.

Learning JavaScript

Last year, the project I was working on at work switched languages for its UI code from C++ to HTML and JavaScript. For me, this meant learning JavaScript and web development.

When I was in college, we studied Java as the “proper” programming language and barely covered JavaScript - only as part of a HTML course. Back then, I never really saw it as anything more than a language for adding simple dynamic features to a web page. However ten years later, and (hopefully!) knowing a great deal more about programming, my opinions have changed. Now, I have a whole new respect for JavaScript, based on features that I wouldn’t have been able to really comprehend back then.

I love the power that first class functions and closures give you. It’s spoiled me as a programmer as I’m finding it hard going back to languages without those features! I know that they are coming, or have recently come, to Java and C++. However given the nature of exising legacy codebases in those languages and that projects may be restricted to earlier compilers, it’ll be a while before they’re mainstream.

There are no shortage of in-depth JavaScript books and tutorials which teach all the features of the language. However learning JavaScript syntax and features is not the problem. The real issue is knowing what features to avoid. Unfortunately it’s incredibly easy to write unmaintainable code in JavaScript if you’re not careful. Luckily there are some very good books written on this topic. The ones I recommend are:

  • Douglas Crockford’s JavaScript: The Good Parts. This is an really good compact book. It allows you to limit yourself to the features of JavaScript which support good software development practices.
  • Nicholas Zakas’s Maintainable JavaScript. Again this book is more than a simple explanation of JavaScript syntax. It’s topics include JavaScript programming practices and build automation. The build process part is especially useful for learning the proper process for building, linting and testing JavaScript code.
  • Marijn Haverbeke’s Eloquent JavaScript. This is available for free on the website. The really cool part about the site is that all the JavaScript code snippets are interactive and can be run on the page while you are reading them.