Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am a freelancer and I earn my bread and butter by helping others write better java-script code. I have good experience with most of the JavaScript frameworks around.

I am wondering if it is worth for me to invest time in learning coffeescript. Who should learn it and who need not ?

share|improve this question
    
This is a fairly vague question. Who should learn it? Whoever wants to. It's just a matter of preference, it ends up being translated into JS anyway. –  Evan Trimboli Apr 30 '11 at 16:04
1  
Related question: programmers.stackexchange.com/questions/72569/… –  Trevor Burnham Apr 30 '11 at 18:15
    
Professionally speaking, start learning stuff when you see enough want ads you'd be a fit for unless you happen to really dislike the thing enough and you have choices of course. –  Erik Reppen Nov 26 '13 at 6:04
add comment

migrated from stackoverflow.com Apr 30 '11 at 17:19

This question came from our site for professional and enthusiast programmers.

closed as off topic by gnat, Corbin March, Walter, Yannis Rizos Mar 3 '12 at 10:35

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers

up vote 8 down vote accepted

First, Coffeescript is not terribly difficult to learn. I was able to become quite comfortable with it over only a few days, and my Javascript was very amateurish - I'm sure that if you're talented with Javascript, it'll be much quicker for you to pick up.

As for whether it's worth learning, I think that's a question that only you can answer. I doubt that it will be as helpful for you as it was for me - coming from Ruby, I found Javascript's syntax to be incredibly messy, and I would constantly introduce errors by dropping a semicolon here or a parenthesis there. Coffeescript made it much easier for me to write working code. If you're already comfortable with writing Javascript, though, I can see how you might find it cumbersome.

My advice would be to take a quick look through the CoffeeScript docs, and try to decide whether you would personally prefer your code looking the way it does now, or the way the example code does there, and you'll have your answer. Just don't be scared away by the learning curve - it's not very steep at all.

share|improve this answer
    
Yes, But how helpful is it when I have to write code using YUI or JQuery ? –  Akshar Prabhu Desai May 1 '11 at 0:54
    
Very helpful. YUI is garbage though. –  Rein Henrichs Jun 7 '11 at 2:27
    
@Akshar Prabhu Desai. CoffeeScript was intended not to break existing JavaScript libraries link, read second paragraph –  OnesimusUnbound Jun 7 '11 at 3:39
add comment

My own experience is that learning CoffeeScript helped me to better understand JavaScript. Of course, I'm an extreme case—I was a mediocre JavaScript programmer, and I decided to write a book on CoffeeScript: http://pragprog.com/titles/tbcoffee/coffeescript

So with that bias out of the way, I'd say: Everyone who isn't an absolute expert on JavaScript (and wants to be one) should learn CoffeeScript. It gives you a fresh perspective on what "the good parts" of the language are. Brendan Eich, the creator of JavaScript, has repeatedly praised CoffeeScript for giving JavaScript an elegant syntax without obscuring its semantics.

Will CoffeeScript help you directly in your freelance work? That's harder to say. There certainly aren't as many jobs asking for CoffeeScript code as for JavaScript code (though it never hurts to ask "Is it OK to use CoffeeScript for this job?"), but then, there aren't nearly as many competing CoffeeScript freelancers either. Of course, you may be able to get away with submitting compiled JavaScript, as long as the hirer doesn't have specific code style requirements. CoffeeScript output is pretty readable, though of course not as good as expertly hand-written JavaScript (assuming the expert knows how to write for humans...).

Finally, I'd note that CoffeeScript has a great community that you can draw on for help. One of the perks of new languages is that, generally, only smart programmers learn them (see Paul Graham's essay "The Python Paradox"). So while there are fewer CoffeeScripters than JavaScripters, you may find it easier to get help with hard problems by having friends in CoffeeScript-land.

share|improve this answer
add comment

Coffeescript caters mainly to those who cut their teeth as programmers with Python or Ruby. I, for one, learned with python, and even though I've used other c-like languages such as c#, php or javascript itself, I always found their syntax cumbersome, verbose and ugly. It's annoying having to deal with all those curly braces, semicolons and line noise.

Coffeescript borrows the best ideas of these languages while keeping javascript's "good parts" untouched. It simply adds a better, more expressive syntax on top. There are things that take several lines of code in javascript that can be expressed with one liners in coffeescript, and those are way more intuitive, clear and expressive.

Examples: How do create an array of numbers from 3 to 10?

myarray = [3..10]

How do you create another array whose items are the previous ones multiplied by three?

newarray = [i*3 for i in myarray]

Just try doing it in plain javascript, and you'll know why Coffeescript is god send for many of us...

share|improve this answer
add comment

I made the conversion from JavaScript to CoffeeScript about 6 months ago and I love it, there are so many places where the syntax just makes life a little easier.

For example you can de-structure an object in an assignment so I just wrote some code like this

func = ({io: io, el: el} -> ...

So you pass it an object and it breaks it apart into its parts, I really love coffeescript

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.