Engage Web logo - horizontal-resized


One more cup of CoffeeScript for the road

One more cup of CoffeeScript for the road

Something quite interesting arrived today on my virtual desk. Its name is CoffeeScript. The basic functionality is that it will take some simple syntax and compile it into Javascript. One of the many issues people have with javascript is its syntax and formatting as it tends to be quite unforgiving when you miss a ; or a )}.

Don’t think twice…

CoffeeScript offers a huge advantage in being able to write more human friendly syntax, and then have it converted into the mess of braces that javascript can be. For instance:

if (test > 10 && test2 < 4) { function1(); } else { Function2(); }
Can be written with Coffeescript as:

if test > 10 and test 2< 4 function1() else function2()

Note the lack of braces and semi colons. A new line marker is sufficient to tell it that this is the end of the line. The big question is whether systems and libraries like this make for lazy programmers. As you no longer have to consider opening and closing braces, ending lines or other standard essentials to coding, you may fall into bad habits and feel your brain come to a screeching halt when presented with raw Javascript.

We have all experienced this when using autocomplete regularly. The day you don’t have it to hand your brain hits a blank spot… was it font-size or text-size? What are the five types of positioning in CSS?

Although this system is a great step forward in trying to untangle the mess that a long and nested Javascript file can be, sometimes the easy route is not always beneficial in the long run.

Latest posts by Steven (see all)

Get in touch

Please enable JavaScript in your browser to complete this form.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Book a consultation with Engage Web

Sorry to interrupt, but would you like to download our FREE Social Media Calendars?

Social Media Calendar Product Mock Up for web

 You can use them to plan your social media and content in advance, saving you time and getting better results. When you use our social media calendars, you'll always know what's trending and what to post about for your business.