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 think somehow building a language which compiles to another language feels like a bad idea from the start, instead of learning javascript properly from the start. Look into Douglas Crockfords Good Parts and then are you hooked. And javascript is not hard - writing good code is hard regardless of language! If you write crappy code in javascript, then you propably will write crappy code in coffeescript or lattescript or what the flavor will be of the day. And to say that coffeescript syntax is beautiful passes me. I like my curly braces and C syntax - and would preferably work in a language which is like that (sorry VB!). And more toys and languages and frameworks for doing the same thing all over again feels not like progress to me anymore!

share|improve this question
4  
So, Java compiling to bytecode and C#, VB.NET and other .NET languages compiling to IL are also bad ideas? –  Oded Oct 12 '11 at 18:57
8  
The difference is people usually don't program directly in bytecode and IL (unless I'm mistaken) whereas programming in Javascript is common, hence his surprise/question. –  wildpeaks Oct 12 '11 at 18:59
12  
this "question" contains three exclamation points and no question marks –  azheglov Oct 12 '11 at 19:02
    
If you like to code in IL then I'm wrong. I'm only thinking that javascript is sufficient at it is. And when it moves to ECMAScript 5 and the strict mode will be implemented in browsers then it will be even better. But I'm not saying that doing something else is completely wrong. I want a discussion of the pros and cons, of why you would prefer something else than js. –  marko Oct 12 '11 at 19:05
1  
___ sucks, am I right? –  TRiG Oct 23 '12 at 15:10
show 4 more comments

closed as not constructive by TheLQ, azheglov, Walter, Mark Trapp Oct 12 '11 at 23:35

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers

CoffeeScript is mostly a different syntax on top of JavaScript.

If you understand JavaScript and truly understand JavaScript, then your allowed to use CoffeeScript if you say, prefer whitespace and ->

I consider the difference between JS & CS to be the same as arguing about

if (thing)
{
  // code
}

if (thing) {
  // code
}

(the latter is better. Anyone who does the former should get shot).

Anyway, the main issue with coffeescript is having people come into it (mainly from rails) and then write coffeescript without knowing javascript.

Therefore coffeescript has all the same flaws as jQuery. They are just more entry points for bad programmers to write more bad JavaScript. We really need to solve code quality somehow.

share|improve this answer
5  
offopic: the latter is better. Anyone who does the former should get shot - it depends on the language - i like first style, but its not compatible with JS, which is my main language ;) –  c69 Oct 12 '11 at 19:54
1  
it depends on the language. I think he meant with respect to JavaScript. –  Vardhaman Deshpande Jan 21 '12 at 6:26
1  
There are also things you simply can't do in CoffeeScript. You have considerably less granular control over object creation and the like. –  Erik Reppen Aug 22 '12 at 0:08
    
Just adding to c69's comment, formatting the first way can lead to actual issues: encosia.com/… –  Buzzology Dec 20 '12 at 4:01
add comment

There is a misconception of JavaScript as a "toy" language. This causes people to regard it as something to be played with, rather than used for anything substantial. Add that to the low barrier for entry (i.e. you already have a browser and a text editor, so you can start writing JavaScript), and you end up with masses of people who don't understand the language writing mass amounts of code, and sullying the name "JavaScript".

There is a higher (absolute) amount of bad JS than other languages because of that increased visibility. Bad habits become commonplace as the bad code propagates throughout the web and people view source on pages that have not been vetted for accuracy or good practice, and JavaScript ends up with a bad name because of it.

For these reasons, people feel the need to build more familiar (more "real") languages that transpile to JavaScript. They want the comfort of classical OO, static typing, and other features that appear in other languages. They see the monstrosities created by inexperienced programmers using JS, and think it must be a result of the "fundamental flaws" (to quote Google) in the language.

</rant>

Anyway, use what you want. I'll stick with my object literals, dynamic typing, and prototypal OO, thanks.

share|improve this answer
1  
Hey but isn't dart going to solve all our problem! (</sarcasm>) –  Raynos Oct 12 '11 at 19:20
    
Amen to that! (Not the dart comment!) –  marko Oct 12 '11 at 20:20
add comment

I think the benefit (disclaimer: I have not used CoffeeScript beyond playing with the example on the website) is that it makes JavaScript a little more intuitive for the crowd it's catering to: i.e. the Ruby/Python people.

I personally don't see a need for CoffeeScript, as I like the JavaScript syntax. However, I see how it could be useful.

share|improve this answer
1  
Yeah, I think the ruby/python syntax looks suspicious to me, because I have mostly been coding in C-style languages like Javascript, C#, PHP, actionscript and java. –  marko Oct 12 '11 at 19:07
4  
It looks fine to me mostly (except the -> and => syntax) since I've used Ruby/Python a little, but I think we shouldn't try to hide away JavaScript due to how ubiquitous it is. Yes, some of it is clunky but learning "pure" JavaScript is IMO a better return on investment due to the proliferation of "pure" JavaScript in the wild. –  Wayne M Oct 12 '11 at 19:12
add comment

Whether you like the syntax or not is subjective, however the fact is that CofeeScript takes care of some annoying JavaScript warts. Of course, it still remains unclear if it is worth introducing a new language and coping with the compilation step.

share|improve this answer
6  
"annoying javascript warts" CoffeeScript does not, it just gives sugar and syntax. I can avoid the warts myself, and I do. –  Raynos Oct 12 '11 at 19:19
add comment

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