3 ms·
I recall there was a post a week ago saying that Rails 3.1 will go with CoffeeScript. Maybe they received lots of negative feedback on that shot, so they fall b
by cygwin98 15y ago
I recall there was a post a week ago saying that Rails 3.1 will go with CoffeeScript. Maybe they received lots of negative feedback on that shot, so they fall back to plan B.
- tomstuart 15y agoUnrelated. CoffeeScript is a language which compiles down to JavaScript; jQuery is a JavaScript library.
- 5l 15y agoNo, CoffeeScript and jQuery will both be defaults in Rails 3.1
- deleted 15y ago[deleted]
- ScotterC 15y agoUnrelated as commented by others but glad you brought it up for anyone else that was confused.
- cygwin98 15y agoMaybe I misunderstood the situation here. I thought the adoption of CoffeeScript is more like going the GWT way (not quite, but similar) --- you write code in CoffeeScript and let it generate all vanilla Javascript code doing the frontend work, e.g., communicating with the server, DOM manipulation. I do personally think that's a good approach. Now, you also have jQuery in the toolkit, which I suppose is used for DOM manipulation, that's another tool to learn. If you guys just replace Prototype with jQuery, it is reasonable, or just CoffeeScript, which is radical, but sounds like a neat approach. However, CoffeeScript + jQuery? I just don't think it make sense here. Honestly, I only have superficial knowledge of CoffeeScript and jQuery, I could be totally wrong. Maybe somebody in the Rails core team should write a blog to clarify their strategy on their Javascript integration.
- notjoeflynn 15y agoCoffeeScript doesn't generate JavaScript in the same way GWT does, it's more a thin layer of syntax for Javascript that compiles one-to-one to Javascript. It's an abstraction layer, rather than a library that provides functionality like jQuery. For reference: http://jashkenas.github.com/coffee-script/ http://jashkenas.github.com/coffee-script/
- cygwin98 15y agoSo in 3.1, if you were to write frontend code, are you supposed to write it in CoffeeScript, or jQuery?
- uxp 15y agoYou can do both, or neither and choose something else you are more familiar with. Just because Rail's opinion is to use X does not mean you do not have the ability to use Y. CoffeeScript is much like HAML or SASS, where the end result is actual Javascript that can be parsed by the browser. It's only designed to make it easier to write the code, not to replace the code. When I write HAML in my Rails app, the app parses it and send the browser actual HTML. CS will do the same.
- joesb 15y agoYou can write CoffeeScript that uses jQuery, so that it compiles down to Javascript that uses jQuery. You can also use Javascript and jQuery directly. Or you can write CoffeeScript without using jQuery at all.
- cygwin98 15y agoMy concern is that those combinations can significantly reduce Rails apps' maintainability. I wonder if jQuery is that good, can it be rewritten in CoffeeScript? Such that we can settle down at CoffeeScript, which looks like a better language anyway, and get rid of the Javascript fragmentation issue all at once.
- deleted 15y ago[deleted]
- petercooper 15y agoNote that this is not news. It just happens to be a blog post about the change. The actual news about switching to jQuery was over a month ago.