Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone used Coffeescript for a production application? [closed]

Coffeescript looks pretty cool. Has anyone used it? What are its Pros & Cons?

like image 332
Esteban Araya Avatar asked Jun 02 '10 02:06

Esteban Araya


People also ask

What can you do with CoffeeScript?

CoffeeScript is a programming language that compiles to JavaScript. It adds syntactic sugar inspired by Ruby, Python, and Haskell in an effort to enhance JavaScript's brevity and readability. Specific additional features include list comprehension and destructuring assignment.

Is CoffeeScript better than JavaScript?

"Easy to read", "Faster to write" and "Syntactic sugar" are the key factors why developers consider CoffeeScript; whereas "Can be used on frontend/backend", "It's everywhere" and "Lots of great frameworks" are the primary reasons why JavaScript is favored.

How do I know if CoffeeScript is installed?

The coffee and cake commands will first look in the current folder to see if CoffeeScript is installed locally, and use that version if so. This allows different versions of CoffeeScript to be installed globally and locally.

Is CoffeeScript dead?

As of today, January 2020, CoffeeScript is completely dead on the market (though the GitHub repository is still kind of alive).


2 Answers

We've started to use CoffeeScript in our product - a non-public facing website which is basically an app for browsing certain kinds of data. We use CoffeeScript as a command-line compiler (not on the server, which we'd eventually like to do).

PROS (for us):

  • It gets rid of a lot of needless clutter in javascript (eg braces, semi-colons, some brackets) to the extent that the code is cleaner & easier to comprehend at-a-glance than javascript
  • 20-30% less lines of code than javascript (to do exactly the same thing)
  • CoffeeScript not only removes noise but adds keywords, classes, and features like heredocs to make coding cleaner and somewhat more enjoyable
  • Given the previous points, it is undoubtedly faster to code in CoffeeScript once you learn the ropes

CONS

  • When using the command-line compiler: to debug, you're looking at different code when solving the problem (javascript) as when writing the fix (coffeescript). However, somewhat unbelievably, our CoffeeScript is so awesome we've never needed to debug it!

Importantly, we can turn back at anytime. Our coffeescript compiler is just producing readable javascript, so if anyone changes their mind or can't figure something out, then we can just drop back to using the javascript that coffeescript produced - and keep coding.

like image 159
PandaWood Avatar answered Nov 08 '22 13:11

PandaWood


We use coffeescript for all of the javascript in BusyConf. A large portion of BusyConf is a client side application that runs in browers, including support for offline mode.

All of our coffeescript code is fully tested. The tests themselves are written in coffeescript, and use the Qunit framework (which is written in javascript). We also wrote an extension to the Qunit framework that makes the tests nicer. The Qunit extension is written in CoffeeScript. Our application has a mobile version which is written in CoffeeScript, and it uses the Sencha Touch framework (which is written in javascript).

The take away from that is that you can freely intermix javascript dependencies in your application, but all of the code you write (your application code, tests, etc) can (and should!) be coffeescript.

like image 22
Jim Garvin Avatar answered Nov 08 '22 12:11

Jim Garvin