Live data from Hacker News

Intro to CoffeeScript

aseemk.com

51–60 of 95 posts

Re: Intro to CoffeeScript

#51
> What I find sad, though, is that most people who dislike CoffeeScript don’t truly know it. They haven’t taken the time to really learn it, or even try it. Their reactions are usually knee-jerk, or based on fallacies.

This sounds a bit like the bi-polar LISP programmer. Belief that he groks things much better than most programmers grok things? Check. Belief that most people are behaving irrationally? Check. Belief that it's foolish to make an obvious choice? Check.

http://www.lambdassociates.org/blog/bipolar.htm

JavaScript is now a moving target. It's what the examples for new "HTML5" features and libraries are written in. It's what an open source library should be written in if you want it to get traction, and to attract other developers. While it may be a good choice for quickly modifying code on a single project, it isn't as good of a choice for something to get great in as JavaScript is.

There's the saying that you need to know JavaScript in order to write CoffeeScript, but you really only need to be able to read JavaScript in order to write CoffeeScript. My guess is that a lot of developers who mostly write CoffeeScript would trip over simple things for a while if they tried switching to JavaScript. This might keep them from seizing opportunities for JavaScript developers such as contributing to an existing JavaScript project or an open source library that's implemented in JavaScript.

Re: Intro to CoffeeScript

#52
post #5

> The explanation for most people’s dislike of CoffeeScript is probably our natural resistance to new things and our comfort in what we know. This is a mildly insulting, as is the invocation of Blub. CoffeeScript doesn't have a ton of exotic features. String interpolation, list comprehensions, and class definitions (!) are all familiar to programmers from other languages. I'm guessing that a lot of people have weighe…

What overhead? If you mean performance, there's actually basically no runtime performance overhead in most cases. In fact, if you use CoffeeScript's "for" loops have a performance advantage over JavaScript Array's map()/forEach() methods. I used to have a similar opinion but was forced to use CoffeeScript on a project and haven't looked back.

The overhead of having an additional dependency. The more moving parts there are, the more things can break.

Re: Intro to CoffeeScript

#53

> What I find sad, though, is that most people who dislike CoffeeScript don’t truly know it. They haven’t taken the time to really learn it, or even try it. Their reactions are usually knee-jerk, or based on fallacies. This sounds a bit like the bi-polar LISP programmer. Belief that he groks things much better than most programmers grok things? Check. Belief that most people are behaving irrationally? Check. Belief t…

While I understand your sentiment... I have to disagree with a few assumptions. I feel that it's perfectly fine to write a project, or even a module in coffeescript. If you look at the NodeJS/NPM ecosystem, you will find a lot of modules will use, or be used by other modules that will be in either JS or Coffee respectively.

While CS supports some features with different syntax than JS, it really isn't THAT hard to pick up, and for the most part I don't care too much. I've mostly written JS, but have used CS for certain bits.. I find the syntax much more pleasant in unit testing, and for grunt tasks in particular (though will likely be using gulp in the future over grunt).

This presentation did show a lot of the niceties with dealing in Classes with CoffeeScript, a lot of which I wasn't aware of... I do tend to keep my objects a bit differently than many though.. I tend to treat my objects as either libraries or effective structures, rarely do I add "smart" methods to my entities.

Will it get me to switch everything, no.. however, multiline strings are nearly enough to get me to strongly consider .coffee for a lot of cases, often I will even mix into .js projects in node.

Re: Intro to CoffeeScript

#54

My biggest issue is that the language can be ambiguous and I'm not sure how to check what I'm compiling to without running the short cut all the time in Sublime Text 2

the coffee console app has a watch parameter iirc.. as do many build tools...

Re: Intro to CoffeeScript

#55
post #25

> What I find sad, though, is that most people who dislike CoffeeScript don’t truly know it. They haven’t taken the time to really learn it, or even try it. Their reactions are usually knee-jerk, or based on fallacies. [...] The explanation for most people’s dislike of CoffeeScript is probably our natural resistance to new things and our comfort in what we know. Oh, wow. I've been using CoffeeScript for about a year…

I love CS myself. To me, in terms of aesthetics, CS is to JS what Scala is to Java. I have been bitten by the whitespace issue that you mention though. I don't recall the circumstance but an indent that was off just a bit did not cause the compiler to complain, but did cause it to generate code that I did not intend. It took some debugging of the JS output to find that one, and it certainly gives one pause to think h…

Comparing Coffeescript to Scala is an outrage! ;)

When I heared about Coffeescript I thought about Scala, too. Not because it reminded me about Scala, but who it took to make Scala and then out of the blue some guy comes along with some new lang, which should ease some problems.

CS is to JS what PHP is to Perl.

Re: Intro to CoffeeScript

#56
post #5

> The explanation for most people’s dislike of CoffeeScript is probably our natural resistance to new things and our comfort in what we know. This is a mildly insulting, as is the invocation of Blub. CoffeeScript doesn't have a ton of exotic features. String interpolation, list comprehensions, and class definitions (!) are all familiar to programmers from other languages. I'm guessing that a lot of people have weighe…

What overhead? If you mean performance, there's actually basically no runtime performance overhead in most cases. In fact, if you use CoffeeScript's "for" loops have a performance advantage over JavaScript Array's map()/forEach() methods. I used to have a similar opinion but was forced to use CoffeeScript on a project and haven't looked back.

> What overhead?

The overhead of tooling, extra dependencies, debugging complexities and new syntactic constructs.

If you're going to pay for all that, why not bite the bullet and use a language which actually improves the states of things and adds useful semantics?

Re: Intro to CoffeeScript

#57

> What I find sad, though, is that most people who dislike CoffeeScript don’t truly know it. They haven’t taken the time to really learn it, or even try it. Their reactions are usually knee-jerk, or based on fallacies. This sounds a bit like the bi-polar LISP programmer. Belief that he groks things much better than most programmers grok things? Check. Belief that most people are behaving irrationally? Check. Belief t…

While I understand your sentiment... I have to disagree with a few assumptions. I feel that it's perfectly fine to write a project, or even a module in coffeescript. If you look at the NodeJS/NPM ecosystem, you will find a lot of modules will use, or be used by other modules that will be in either JS or Coffee respectively. While CS supports some features with different syntax than JS, it really isn't THAT hard to pi…

"If you look at the NodeJS/NPM ecosystem, you will find a lot of modules will use, or be used by other modules that will be in either JS or Coffee respectively"

The big thing for me with Node.js was you could have whole application in one language. Apparently it's not possible anymore because you have to deal with CoffeScript.

Re: Intro to CoffeeScript

#58
I would just say that there are big differences between a JS `for` loop (`for in` in CS) and an ES5 `forEach`. The fact that you are creating a new function scope and are not returning all elements as you might expect:

  arr = new Array 3
  arr.push 4

  ( alert el for el in arr )

  arr.forEach alert

Re: Intro to CoffeeScript

#59

Earlier quoted context omitted.

What overhead? If you mean performance, there's actually basically no runtime performance overhead in most cases. In fact, if you use CoffeeScript's "for" loops have a performance advantage over JavaScript Array's map()/forEach() methods. I used to have a similar opinion but was forced to use CoffeeScript on a project and haven't looked back.

The overhead of having an additional dependency. The more moving parts there are, the more things can break.

Then why don't you write assembly?

Re: Intro to CoffeeScript

#60
post #5

> The explanation for most people’s dislike of CoffeeScript is probably our natural resistance to new things and our comfort in what we know. This is a mildly insulting, as is the invocation of Blub. CoffeeScript doesn't have a ton of exotic features. String interpolation, list comprehensions, and class definitions (!) are all familiar to programmers from other languages. I'm guessing that a lot of people have weighe…

So far, I thought CoffeeScript as something neat to use. After going through the slides, I now think it is not worth it for a mildly seasoned javascript programmer. I can see how it could help a newcomer to avoid javascript pitfalls, but those pitfalls could also be covered with a few commandments to follow.

I'm what I would consider a "well-seasoned" JavaScript developer and disagree. I think CoffeeScript is better for people who already know JavaScript decently well than newbies. CoffeeScript doesn't help you avoid learning JavaScript, it just makes it more pleasant.
Post reply on HN