Live data from Hacker News

Poll: Have you moved from JavaScript to CoffeeScript?

news.ycombinator.com

91–100 of 178 posts

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

#91

Earlier quoted context omitted.

This is a lame reason not to have tried it yet, but I need to first skim a short tutorial that shows how to integrate with jQuery and ideally also shows simple uses of Backbone and Underscore in coffeescript. BTW I love Backbone and Underscore and thanks to them (and also node) JS is actually more fun than ever.

I'm actually about to make a dip into using Backbone so I've been holding off on transitioning to CoffeeScript to limit my shock. I've played around with the editor at GitHub though and I really like how CoffeeScript reads. That being said, actually using it in the wild seems is road I'm not quite ready to cross yet.

I've started using Backbone.js in a very limited way for some of our existing apps.

What I'm doing is just using views as a way to provide some structure to what is currently a mess of jQuery event bindings and DOM manipulation. So instead of have a Backbone view that gets configured with a template and passed a model to render, I just do some setup code in the initialize function and then use Backbone's event function to setup all my event bindings for different DOM events that will occur within the element that is the root of that particular view.

This is working really well so far. It doesn't require completely rewriting the app to be a single-page client side heavy application, but does provide a significant amount of structure to the code making it much more manageable. It also lets me reuse some views (sort of like widgets) that were previously tied directly to specific elements in the DOM.

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

#92
post #72
post #66

Earlier quoted context omitted.

Yes, and why would I want less of JavaScript's syntax in my life when it has so much overlap with other languages I use like PHP?

Well, you do choose Javascript when you could have chosen PHP and had even more overlap. Presumably, because you believe it is better for the tasks. Similarly, Coffeescript authors believe that Coffeescript is better than Javascript -- even if there's less overlap.

I don't use JavaScript for anything for which I could have chosen PHP. Given that PHP runs in exactly 0 browsers, what do you mean? Few people are choosing server-side JavaScript over PHP, though it may happen occasionally.

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

#93
post #68

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.

What's the problem with the extra compilation step? You can simple use coffeescript by adding "script type=text/coffeescript" tags to your code while developing, and when you are done, just compile and deploy. Or you can simply authomate the task (google for instructions).

Yeah, and what happens when it introduces a weird bug?

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

#94
post #68

Earlier quoted context omitted.

What's the problem with the extra compilation step? You can simple use coffeescript by adding "script type=text/coffeescript" tags to your code while developing, and when you are done, just compile and deploy. Or you can simply authomate the task (google for instructions).

Yeah, and what happens when it introduces a weird bug?

You report it and they fix it?

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

#95
post #88

Couchbase shipped coffeescript as an officially supported language for couchdb design documents (views, filters, show and list functions, etc...). I started using it when Jan committed that and have enjoyed it quite a bit since.

As I'm learning couchdb and plan to use it for a project, the coffeescript addition for map/reduce certainly gave me cause to look more closely at coffeescript

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

#96
post #68

Earlier quoted context omitted.

What's the problem with the extra compilation step? You can simple use coffeescript by adding "script type=text/coffeescript" tags to your code while developing, and when you are done, just compile and deploy. Or you can simply authomate the task (google for instructions).

Yeah, and what happens when it introduces a weird bug?

As you've been developing in CoffeeScript up until that point, explicit compilation doesn't really change code and isn't likely to introduce new bugs.

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

#97
post #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…

Is it difficult to debug the resulting code?

Browser implementors are working on making easier to debug all compile-to-JS languages, including regular minified JavaScript code.

https://bugzilla.mozilla.org/show_bug.cgi?id=618650

https://bugs.webkit.org/show_bug.cgi?id=30933

In the meantime, CoffeeScript tries to make debugging easy by compiling to straightforward, readable JS, with meaningful variable names, normal indentation, and all that. Patches to make the output clearer/cleaner for specific bits are always welcome.

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

#98
post #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…

Is it difficult to debug the resulting code?

I use coffeescript both clientside and serverside (node). Since semantically the coffeescript maps to javascript almost one-to-one, the only debugging difficulty is mapping line numbers in the error output to the location in the coffee file.

Client-side is zero problem because the chrome and firebug developer tools jump you right to the line in the JS file, and you can figure out where the error is there since the compiled coffeescript is very readable.

Server-side has a slight hassle since there's no clickable link, so the line numbers don't help much, but a quick look at the stack trace makes it pretty easy to find where in the coffeescript its referring to.

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

#99
post #38

One of the interesting things on doing some analytics on our customer base was seeing just how wide the gap is between the usual HN fare and reality: http://blog.directededge.com/2010/05/30/what-programming-lan... The core message being: things like Scala, Erlang, et al still represent a tiny portion of the actual tech world. (And our customers tend to be biased towards being techy anyway.) Just because CoffeeScript…

That shouldn't be surprising. A willingness to learn new and esoteric languages is one of the hallmarks of HN-ers. See also: The Python Paradox (http://www.paulgraham.com/pypar.html).

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

#100

Earlier quoted context omitted.

Is it difficult to debug the resulting code?

I use coffeescript both clientside and serverside (node). Since semantically the coffeescript maps to javascript almost one-to-one, the only debugging difficulty is mapping line numbers in the error output to the location in the coffee file. Client-side is zero problem because the chrome and firebug developer tools jump you right to the line in the JS file, and you can figure out where the error is there since the co…

Have you tried using node-inspector for server-side code debugging? https://github.com/dannycoates/node-inspector
Post reply on HN