SumOfUs / sumofus

0 stars 0 forks source link

CoffeeScript or JavaScript? #7

Closed EricBoersma closed 9 years ago

EricBoersma commented 9 years ago

Hey, so we've got some code in our main repository in JavaScript, and some in CoffeeScript. Ideally, we won't have this split - maintaining a single language to do similar tasks makes the code base simpler to grok from the beginning, and helps to make sure we're not repeating ourselves or making mistakes due to language switches.

The advantages of CS is that it is noticeably more terse and as a language, reads much more nicely than JS. The disadvantages are that errors in CS can be difficult to debug due to the fact that it's compiled to much-more-difficult-to-read JS and it can be difficult to know what's going on under the covers.

One thing that helps in trying to have this discussion is http://coffeescript.org/ which provides an online overview of the language and its capabilities.

I'm very open for conversation about which option we want to pursue here, but I'd really like the team to have a single language choice which we can standardize on going forward.

Thanks!

Tuuleh commented 9 years ago

Hoi! I had a look at what Omar mentioned about there being a move from Coffeescript to ES6, and there definitely is a lot of motion that way. Mostly the reason seems to be that most of the things that made CS popular are baked into ES6. There are a lot of blog posts, migration guides etc, e.g. https://robots.thoughtbot.com/replace-coffeescript-with-es6.

I did find one post about not going to ES6 from CS for the transpilers because it's essentially not worth the effort ( http://noredinktech.tumblr.com/post/111583727108/dont-replace-coffeescript-with-es6-transpilers), but I get that this applies more to existing stacks than to new projects like ours.

Personally I'd rather go with JS - I don't mind the syntax and I see value in being able to write high quality JavaScript without a wrapper. I'd also rather learn JS because it has better transfer across different front end solutions than CS. I'm not very strongly opinionated on the matter, but I might be a little demoralized about the prospect of learning CS when I already know JS, and I would be interested in learning more 'up-to-date' JavaScript with all the good stuff that comes out with new releases.

On Tue, Jul 21, 2015 at 10:56 AM, Eric Boersma notifications@github.com wrote:

Hey, so we've got some code in our main repository in JavaScript, and some in CoffeeScript. Ideally, we won't have this split - maintaining a single language to do similar tasks makes the code base simpler to grok from the beginning, and helps to make sure we're not repeating ourselves or making mistakes due to language switches.

The advantages of CS is that it is noticeably more terse and as a language, reads much more nicely than JS. The disadvantages are that errors in CS can be difficult to debug due to the fact that it's compiled to much-more-difficult-to-read JS and it can be difficult to know what's going on under the covers.

One thing that helps in trying to have this discussion is http://coffeescript.org/ which provides an online overview of the language and its capabilities.

I'm very open for conversation about which option we want to pursue here, but I'd really like the team to have a single language choice which we can standardize on going forward.

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/SumOfUs/sumofus/issues/7.

EricBoersma commented 9 years ago

Thanks for the info on ES6, Tuuli. I'd generally agree with the author of the second blog post you linked - if we were to go this way, ES6 is something we should definitely think about as primarily another transpiled language, just like we would think about CoffeeScript. From that perspective, I can see one primary advantage to ES6 over CoffeeScript, which is that as time goes on it should achieve much wider adoption than CoffeeScript since it will become "native" JavaScript and thus be what most people are learning. The skills to take away from ES6 should also be more generally useful down the road, which would cause me to lean that way.

@osahyoun Do you have thoughts?

osahyoun commented 9 years ago

Ha! I missed this discussion entirely. I'll read and post my thoughts now.

osahyoun commented 9 years ago

Personally I'd rather go with JS - I don't mind the syntax and I see value in being able to write high quality JavaScript without a wrapper.

I totally agree.

I'm in favour of ES6.

EricBoersma commented 9 years ago

OK! I don't want to end this conversation yet since @NealJMD was the one who originally wanted to have it and I want him to have a chance to read the arguments and respond if he feels he's got information that's relevant, but I'm feeling a pretty strong lean toward ES6.

NealJMD commented 9 years ago

Hey guys, wanted to weigh in on this. I was originally very much pro coffeescript (which is why I started writing it in the repo) because it's way way better than ES5, and I'm still happy to hold that position. However, until I did some reading yesterday I hadn't realized that ES6 transpilers like babel let us start writing ES6 today. I agree that if most of the team needs to learn a new syntax anyway, it makes sense to learn the one that's a new standard. I'm down to use ES6 across the repo.

My only hesitation is whether the great rails features for coffeescript support babel yet. Primarily I'm talking about source maps. Eric, you mentioned that "CS can be difficult to debug due to the fact that it's compiled to much-more-difficult-to-read JS." Thats actually not true in Rails - the framework does some sweet source map magic so you get tracebacks and line-errors from your coffeescript code, not the compiled JS. In a few minutes of Googling, it's unclear if that's supported for babel, but I hope it is.

NealJMD commented 9 years ago

Day 1 writing JS instead of CS and I'm having serious syntactic sugar withdrawal. this stuff is so damn verbose and ugly compared to coffeescript.

NealJMD commented 9 years ago

I accept that all the cool kids are writing ES6 and Babel is great so I'm closing this.