Live data from Hacker News

Poll: Have you moved from JavaScript to CoffeeScript?

news.ycombinator.com

51–60 of 178 posts

Re: Poll: Have you moved from JavaScript to CoffeeScript?

#51

I just did my first tiny project in coffeescript and found it to be an odd experience. I was far too aware that I was programming in tokens that needed to map to JavaScript. Far too often I had to go back to the interactive "Try CoffeeScript" form on the website to peck things into until the parser errors went away. To those more experienced: at some point does thinking in pure coffeescript take over, and the JavaScr…

Yep - it goes away. When I started coffeescript I'd check the output of every statement I wrote (and had heaps of parser errors). Once I had a good idea of how it was being converted I stopped checking... I'm still not a fan of some of the output (I wouldn't write my JS like that, that's for sure!) but damn it's fun!

Re: Poll: Have you moved from JavaScript to CoffeeScript?

#52
post #47

Earlier quoted context omitted.

I've never done front end before (I just hate the JS syntax, so I've avoided it, besides a few jsonp requests) but with CoffeeScript I was persuaded to give it a try. Here is my problem. Nothing is Google-able. Even basic things that I get caught up on the answer on IRC is usually "look up how to do it in JS, and then reform it to CS". Maybe I'm starting on the wrong stuff, but even though the syntax is wonderful, ac…

http://jashkenas.github.com/coffee-script/ http://coffeescriptcookbook.com/ Tutorial/screencast links: http://stackoverflow.com/questions/5124706/is-there-a-screen... A talk by Jeremy: http://ontwik.com/javascript/jeremy-ashkenas-on-coffeescript...

Interesting. I'd gone through the first link before, but the second is quite good. Still doesn't change the fact that most libs you are using are written in JS (not to mention a whole new platform, the browser) and therefore harder to Google for, but thanks for your help.

Re: Poll: Have you moved from JavaScript to CoffeeScript?

#53

This is going to be a very interesting poll result. Even 5 or 10% penetration is something remarkable, for a language as widely-used as JavaScript. If you feel like providing any more color beyond your vote, your impressions after using CoffeeScript in anger -- I'd love to hear 'em.

I've never done front end before (I just hate the JS syntax, so I've avoided it, besides a few jsonp requests) but with CoffeeScript I was persuaded to give it a try. Here is my problem. Nothing is Google-able. Even basic things that I get caught up on the answer on IRC is usually "look up how to do it in JS, and then reform it to CS". Maybe I'm starting on the wrong stuff, but even though the syntax is wonderful, ac…

2 days? Give it 2 weeks and you won't look back. I do think it's more suitable to writing a "new big app from scratch" -- fixing up some consulting client's website with some new JS widget and 5-20 lines of integration scripting or some such isn't the use-case where CoffeeScript gives you a notable advantage.

Re: Poll: Have you moved from JavaScript to CoffeeScript?

#54
After reading posts about it on here for maybe a year, I recently decided to try it for a small jQuery plugin. I enjoyed it so much that we immediately switched to writing all new code in CoffeeScript and have begun converting existing code as time allows.

The benefits over straight JavaScript are amazing—I’d been writing careful code that drew from the ‘good parts’ mentality and pre-declared all variables, etc. Now I hardly ever have to worry about it.

As I continue to write Rails code I wish I could skip commas in hashes. I didn’t really have an opinion on significant whitespace before (only briefly played with Python) but now I love it. It’s also the first time I’ve used splats, and I was delighted by the brevity it can achieve in combination with the erb-esque interpolation: http://cl.ly/2b371b380g3j071E2g0h

The integration with docco has rewarded my habit of trying to write good documentation. I’ve tried to enforce a policy that any new CS must be documented.

Re: Poll: Have you moved from JavaScript to CoffeeScript?

#55
I have used Javascript exclusively on client and server since late 2008. First Rhino and then Node. Before that I used Rails.

I can understand the syntax gripes that some people have towards Javascript but I think this has more to do with a Ruby notion of "elegance" coupled with a lack of familiarity with Javascript then it does with actual issues with Javascript. In fact, I prefer Javascript to Ruby.

I have gone the whole way with Prototype and then the whole way back. These days I prefer using just 20 or so functional DOM helpers rather than Prototype's Element extensions or JQuery's wrappers. A handful of DOM functions are significantly faster. As a result I have found it useful to keep third party dependencies to a minimum. A minimum of zero is working well for me so far. Writing raw Javascript is refreshing, even if it means a "prototype" here or there. I have written many "var" statements and have yet to see an undeclared variable pollute the global scope. I write for loops often. Sometimes I use forEach or reverse while loops. I don't seen any need for Coffeescript enumerators.

I keep checking up on Coffeescript from time to time but I prefer the explicit syntax of Javascript. After spending hours refactoring code the Rails way, I have come to prefer code that's big-O efficient, as fast as possible, as direct as possible, and if it takes a few lines less that's great.

Re: Poll: Have you moved from JavaScript to CoffeeScript?

#56
SyncPad switched its webclient from JS to CoffeeScript.

In terms of human-readable code, we reduced the lines of code by ~30%. It's cleaner and more concise. I feel our code is more managable because of CoffeeScript.

In terms of the generated JS, I really appreciate that CoffeeScript creates an abstraction that will implement JS best practices and consistency

At this point, any JS work I do is done with CoffeeScript

Re: Poll: Have you moved from JavaScript to CoffeeScript?

#57
post #46

I started writing some of my code in coffeescript a while ago, but then I started a coffeescript project that grew into a file of 2000 lines and it became very hard to skim the code and gather meaning from it because of the lack of parenthesis and the indentation-based nature of it.

If your file is disorganized, I bet spaces and parentheses have very little to do with it.

Re: Poll: Have you moved from JavaScript to CoffeeScript?

#58
I think CoffeeScript looks quite cool, but I'm afraid introducing a compilation layer will complicate my life and lead to weird issues which will cancel out any productivity gains. And while Javascript may not be perfect, it's good enough to get the job done.

Re: Poll: Have you moved from JavaScript to CoffeeScript?

#60
post #42

When I first saw CoffeeScript I thought it was the best thing since sliced bread. I mean, it's beautiful to look at (and enjoyable to write). I was positive that it was going to replace JavaScript in my toolbox. Except, for whatever reason, it never did. It may just be because regular old JavaScript is already familiar, but whenever I needed to knock out any client-side code I'd have half the thing written in JS befo…

you can try js2coffee which will convert all existing js file to coffee-script.
Post reply on HN