Live data from Hacker News

CoffeeScript: The beautiful way to write JavaScript

amix.dk

41–50 of 88 posts

Re: CoffeeScript: The beautiful way to write JavaScript

#41
post #4

I can't shake the feeling that people that like CoffeeScript are those that don't "get" JavaScript (e.g. CoffeeScript's notion of a class, whereas JavaScript has none -- let go an embrace the prototypal object model). Further, most (if not all) of the examples of the problems with JavaScript are null and void. A language that combines paradigms? Most do. Sure, the name sucks, but that's hardly an issue. I understand…

> let go an embrace the prototypal object model

JavaScript itself doesn't embrace a prototypal model. When was the last time you cloned an object to create a new one in JS?

JavaScript's model is much closer to classes than prototypes. The only real significant difference is that unlike class systems, JavaScript allows inheriting both "methods" and "state" from its "class". Otherwise, the language works more or less like a class-based one.

Re: CoffeeScript: The beautiful way to write JavaScript

#42
post #18

Earlier quoted context omitted.

In this case, the semantics were already decided: CoffeeScript was intended to map transparently to JavaScript. Each change to semantics would add complexity to that mapping.

Syntactic sugar is all CoffeeScript can ever be. Is pretty syntax better than common-use syntax? (To be clear: I don't have a strong opinion. I'm curious what the community thinks the value proposition for CoffeeScript, HAML, etc is.)

Hm, to me the value proposition is this:

There are many, many interesting projects that I want to look at, read, potentially use or learn from.

Every little help for reading and understanding many open source projects faster is a huge value and a huge timesaver for me.

I think that clean syntax is just the better tool, like other people would probably prefer an IDE with integrated toolchain and dozens of tools that are modeled after the state of a programming system at some point in time.

Readable semantics behind a clean syntax are the more flexible toolchain in my eyes. It's like an integrated user interface. I can easily read and understand CS/Haml/Sass/Ruby/.. in my own files, in some libraries that i installed, in posts on blogs and on github ..

Re: CoffeeScript: The beautiful way to write JavaScript

#43

I couldn't agree more. The biggest problem with CoffeeScript adoption is the administrative overhead required for novices to get it running. This means that most CoffeeScript projects are usually larger -- it just doesn't get used in small one-off things. My company's product is a hosted CMS and we just tackled this problem ( http://www.gethifi.com/blog/hosted-cms-coffeescript-support ) by completely eliminating the…

I started toying with CoffeeScript a while back for my own entertainment and found the administrative overhead was much less than I anticipated. I went from a clean slate to being up and running in like five minutes. Once I had node and CoffeeScript installed, it was just a single command-line to start a watch on my .coffee file and then I was back to "refresh browser window to see my changes" mode just like regular JS.

Re: CoffeeScript: The beautiful way to write JavaScript

#44
post #18

Earlier quoted context omitted.

In this case, the semantics were already decided: CoffeeScript was intended to map transparently to JavaScript. Each change to semantics would add complexity to that mapping.

Syntactic sugar is all CoffeeScript can ever be. Is pretty syntax better than common-use syntax? (To be clear: I don't have a strong opinion. I'm curious what the community thinks the value proposition for CoffeeScript, HAML, etc is.)

Well it seems your assumption that "pretty" is purely a luxury, something that's nice to have but serves no practical purpose other than aesthetic satisfaction.

Personally I disagree.

I think a programming language is not like a car, at least not in that with a car whether it's pretty or not has no practical effect on the utility of the car.

You are using the computer language to express your own ideas, and to formulate your own constructs via it's syntax and semantics.

When the language's syntax and semantics are clunky, verbose, and full of line noise....those things become intermingled with your ideas and your semantics and it becomes difficult to separate the two.

I've been writing Javascript a long time, and what I like about CS is not only that it makes writing code easier by providing shortcuts for patterns I use constantly, but that the finished code more closely resembles the actual ideas I had when I wrote the code. With syntax and semantics that get out of the way you can focus more closely on your ideas and how to improve or fix them imho.

Re: CoffeeScript: The beautiful way to write JavaScript

#45
I've done my fair share of web programming. But JavaScript (for me) has always been to add the flash, not to write the app. In the past couple of months, I dove into Backbone.js, Sammy.js, etc. and while my JavaScript worked, it wasn't "the JavaScript way".

When I found CoffeeScript, I was very happy. But I've been moving back to more JavaScript recently because I've spent hours looking through the generated JavaScript and learned quite a bit from it. I did the same with my C compiler and x86 Assembly :) It's nice to read what the experts think the final product should look like.

So write some CoffeeScript, compile it, and learn some JavaScript from it.

Re: CoffeeScript: The beautiful way to write JavaScript

#46

Earlier quoted context omitted.

> Is pretty syntax better than common-use syntax? What do you mean?

Javascript is understood by most developers these days. CoffeeScript is pretty. (Edit: I don't think that "pretty" is a bad thing. I just... when is it the most important thing, or even high up on the priority list? Pretty isn't bad, but if it means learning an entirely new syntax and immature toolchain, its value for all but personal projects is unclear to me. I see that others value it differently, and I'm trying t…

For competent Javascript developers the learning curve to CoffeeScript is an afternoon tops, because it is Javascript. If you consider that, it essentially becomes a free lunch since now you can express your ideas more clearly than raw JS.

Re: CoffeeScript: The beautiful way to write JavaScript

#47
post #46

Earlier quoted context omitted.

Javascript is understood by most developers these days. CoffeeScript is pretty. (Edit: I don't think that "pretty" is a bad thing. I just... when is it the most important thing, or even high up on the priority list? Pretty isn't bad, but if it means learning an entirely new syntax and immature toolchain, its value for all but personal projects is unclear to me. I see that others value it differently, and I'm trying t…

For competent Javascript developers the learning curve to CoffeeScript is an afternoon tops, because it is Javascript. If you consider that, it essentially becomes a free lunch since now you can express your ideas more clearly than raw JS.

Interesting. To me, CoffeeScript is emphatically not JavaScript. There are new tools and, well, there's a new syntax. Semantically they may be (almost) equivalent -- but it strikes me as a far stretch to say they're the same, or that developers will treat them the same. I suppose I would feel similarly about HAML, too.

Re: CoffeeScript: The beautiful way to write JavaScript

#48

Earlier quoted context omitted.

Syntactic sugar is all CoffeeScript can ever be. Is pretty syntax better than common-use syntax? (To be clear: I don't have a strong opinion. I'm curious what the community thinks the value proposition for CoffeeScript, HAML, etc is.)

Well it seems your assumption that "pretty" is purely a luxury, something that's nice to have but serves no practical purpose other than aesthetic satisfaction. Personally I disagree. I think a programming language is not like a car, at least not in that with a car whether it's pretty or not has no practical effect on the utility of the car. You are using the computer language to express your own ideas, and to formul…

My perspective is a little more subtle than that. To clarify:

"Pretty" is great -- desirable, even. But if "pretty" comes at the cost of using immature tools that may slow me down, or at the cost of forcing my development team to learn a new syntax just because I believe it's "pretty" -- well, that's a harder value proposition.

That's what I'm trying to get at with all this. It sounds like, to you, the level of "pretty" in CoffeeScript outweighs the potential disadvantages -- which is great!

I do like the notion that CoffeeScript syntax gets out of the way; that it lays constructs and ideas bare in a way that JavaScript does not.

Re: CoffeeScript: The beautiful way to write JavaScript

#49

Out of curiosity: What's with today's obsession over beautiful syntax? Shouldn't we strive for beautiful semantics, instead?

Also, with a language like javascript, shouldn't we worry more about faster performance then beautiful syntax.

Re: CoffeeScript: The beautiful way to write JavaScript

#50

Earlier quoted context omitted.

Well it seems your assumption that "pretty" is purely a luxury, something that's nice to have but serves no practical purpose other than aesthetic satisfaction. Personally I disagree. I think a programming language is not like a car, at least not in that with a car whether it's pretty or not has no practical effect on the utility of the car. You are using the computer language to express your own ideas, and to formul…

My perspective is a little more subtle than that. To clarify: "Pretty" is great -- desirable, even. But if "pretty" comes at the cost of using immature tools that may slow me down, or at the cost of forcing my development team to learn a new syntax just because I believe it's "pretty" -- well, that's a harder value proposition. That's what I'm trying to get at with all this. It sounds like, to you, the level of "pret…

This is all anecdotal, but learning CoffeeScript took me no more than a few hours, and I seem to be able to write CoffeeScript faster and with less errors than JavaScript. Obviously YMMV, but it's not just about "pretty".
Post reply on HN