Learn Javascript for the 2012

So we are here again talking about Javascript. I have already wrote an article comparing a well known SmallTalk implementation to Javascript. If my ideas are right (at least a bit), you will see more and more javascript on the next months. In particular:

  • JavaScript is the Ajax programming languge for the rest of us
  • Mobile Framework like PhoneGap and Appcelerator, are all about javascript at the top
  • Javascript is evolved, and it is used server side by projects like node.js

Getting Started

JavaScript is a language must be re-learned if you are old like me (i.e. born before 1982).
This book will re teach you javascript in ten minutes or so on. A very nice and funny read, for 25 pages!
A lot of the things you will read will be new to you, for sure.
Studing good librabries is a must. JQuery is a very well written and commented library: grab the full sized source and start reading it.

Getting your hands dirty

A good way of learning is trying to make your own errors :)
QUnit is a unit-testing framework you can run in your  browser, which will be very useful to you.
If you prefer nodejs, vows is a continuous integration library which will save your days. I prefer vows in these days, because it can run from the command line, and it is easy to setup.

Phase3: Evolving to the next step

Coffee Script is a very instructive language. Look how CoffeeScript renders its code in JavaScript:it will avoid you a lot of mistakes.

And this bring us to a very sad rule: discipline in JavaScript is fundamental to avoid nasty bugs.

The good news is you can catch nasty bugs using a test driven approach, testing all the major functionalities of your application.

Also, it is quite simple to build a test environment in JDK 1.6 because it has already a basic JavaScript engine inside it. Consider using it if you need a fast&dirty JavaScript platform.

 

Conclusions, (sort of)

After 15 years of programming (with JavaScript always in some file in the web projects) I have some advice…

  1. Never ever try to build your own low-level library. It will be bugged. A lot bugged. Even if you are smart.
    Use as much as possible libraries with a proven track record of success. Prototype, JQuery and Underscore are some nice example and they are already here for you
  2. A savy mix of OOP and functional programming will give you a safe programming environment (sort of, at at least).

One thought on “Learn Javascript for the 2012

Comments are closed.