Posted by & filed under Content - Highlights and Reviews, Web Development.

CoffeeScript is a little language created by Jeremy Ashkenas to speed up your JavaScript development. The golden rule of CoffeeScript is: “It’s just JavaScript”, as CoffeeScript compiles into JavaScript directly at compile-time. CoffeeScript offers its own syntax with a few simplifications compared to JavaScript, but it doesn’t want to substitute JavaScript; it just wants to decrease your development time. CoffeeScript also generates clean compiled JavaScript code and allows you to embed pure JavaScript and JavaScript libraries.

Try out CoffeeScript to check if you can enjoy its syntax. To have just a taste of what CoffeeScript looks like, let’s analyze a function that converts the temperature from Celsius to Fahrenheit, and let’s compare the JavaScript version with the correlated CoffeeScript version. This is the JavaScript version:

This is the CoffeeScript version:

You will notice the simplifications in CoffeeScript. There are a few rules to learn, so there is a learning curve before getting up to speed with CoffeeScript, but you can end up decreasing your JavaScript code lines by using it.

Safari Books Online has the content you need

Take advantage of these CoffeeScript resources in Safari Books Online:

Programming in CoffeeScript covers everything experienced web developers need to evaluate CoffeeScript, “think” in CoffeeScript, and write high-performance software with it.
The Little Book on CoffeeScript shows JavaScript developers how to build superb web applications with CoffeeScript, the remarkable little language that’s gaining considerable interest.
Rails 3 in Action of course covers Rails 3, but in chapter 9, you learn how to test parts of your application that use JavaScript and about CoffeeScript, a neater language that compiles down to JavaScript.

About this author

Sebastiano Armeli-Battana is software engineer focused on JavaScript and Java development and he is really passionate about Web technologies. He works as consultant in SMS Management & Technology adopting Java technologies and he also works as Web freelancer. He is the author of a jQuery plugin called JAIL and he maintains his personal site at http://www.sebastianoarmelibattana.com.

Tags: CoffeeScript, Javascript,

2 Responses to “CoffeeScript: A Language That Compiles Into JavaScript”

  1. mjy

    Simplifying JavaScript is good. It’s also nice that your users don’t need to download JavaScript framework code. I wonder if it also makes JavaScript a little less error prone?

Trackbacks/Pingbacks

  1.  CoffeeScript: A Language That Compiles Into JavaScript « Safari … - EtondeGroup Blog of Web Applications | EtondeGroup Blog of Web Applications