Learning JavaScript

I’ve been developing websites for fun and profit over the past ten years, and like many others was self-taught. Over time I picked up HTML & CSS, PHP, MySQL, cloud server setup and administration, and even became an expert in Drupal CMS. Last year I learned and fell in love with Bootstrap which helped me become vastly more efficient while saving me from responsive CSS hell. Even with this background, I recognized one glaring hole in my tool belt was often too embarrassing to admit: I didn’t know JavaScript. Yes, of course I could Google around for code to jackhammer into my website as good as the next guy, but deep down I knew I was just a JavaScript hack.

So I decided once and for all to dive into JavaScript, and over the past few months I read and watched countless tutorials, books, and videos. For anyone who possesses a similar volition to jump down the rabbit hole, here’s my guidance that stems from what I have learned to date:

  1. Begin with Node.js: Node is a platform (including a runtime interpreter) for JavaScript meant for server-side applications. As a guy who grew up on the command-line, I found writing code in text files executed from the command-line (versus client-side JavaScript in HTML via a browser) to be much more intuitive. Beyond that nuance, Node enforces a non-blocking event-driven model that frankly helped me better understand JavaScript as a functional language. Which leads me to my second point…

  2. Embrace JavaScript’s Functionalness: You can write in an object-oriented style in JavaScript, but unlike its namesake Java, JavaScript does not force you into that paradigm. “What else is there besides OOP?”, you may ask? Functional programming is arguably the strongest advantage of JavaScript over OOP-constricted languages. Take the time to read this blog post that convinced me of its merits and opened my eyes to a non-OOP-centric world.

  3. Learn the Good Parts: As you learn JavaScript, you will quickly discover that there are a variety of ways to accomplish a single task, and some of those ways can get you in trouble. Without diving into the details, you may wish to refer to Douglas Crockford’s book, JavaScript: The Good Parts.

  4. Investigate web application frameworks like AngularJS: As with any language, JavaScript does not force good architectural practices upon you. Countless blog posts warn that using jQuery ad hoc to directly manipulate the DOM can often lead to non-scalable, difficult to maintain web applications. In contrast, MVC and related software architectures are tried and true, and especially fit well for web apps. Platforms for building MVC web apps in JavaScript are already developed by the open-source community, and I recommend learning at least one of them. In the end, I found AngularJS to be the most intuitive, though you may consider other ones like Backbone.js. After much digging around, I found this set of videos to the most helpful to learn and see Angular in action.

  5. Check out Apache Cordova: Are you thinking about developing a mobile web app? Of course you are; who isn’t. I stumbled upon Phonegap (which was made open and available to Apache, and named Cordova). Normally when you think of mobile app development, you think of developing in Java or C#. Cordova is a platform for developing mobile apps using HTML, CSS, and JavaScript. The real trick here is that the same code you write in JavaScript (and HTML/CSS) can be compiled on to different devices, including iPhone/iPad and Android. I mention Cordova because as you develop your website or web app using JavaScript, depending upon it’s complexity, it is possible that without too much more effort you could generate both iOS and Android versions of the application.

Again, I am still learning JavaScript and continue to explore the ecosystem that surrounds it…so I am by no means an expert after three months. However, I hope this was a helpful springboard for folks who find themselves where I was just a few months ago.