Decaffeinating a Large CoffeeScript Codebase Without Losing Sleep
eng.datafox.com
eng.datafox.com
I loose "nerd cred" for it, but it's better for my clients that way.
I loose "nerd cred" for it. Please. Give me a break. Half the people here will fall over themselves agreeing with you and you know it. Heck, I agree with you.
Can we please, as a community, get over ourselves? Can we get over this "ermegerd I'm not gonna use the latest JS framework! Guess that makes me 'not cool'! Haha I'm so level headed teehee guiltyyy!" We get it! Most people, the silent majority, don't use new things. We know! We are them. It's ok. Stop. dont humblebrag about how productive you are on Procrastination News.
I've never been on Tumblr but I imagine this is what some of it is like.
Sorry for singling you out. It's just a bugbear, is all. You're probably a solid guy / girl and I do believe you deliver great value for your clients. Honestly.
I'm not trying to brag (didn't even realize it could be read that way), I'm trying to validate both myself and other people like me.
It's about competitive advantage. Some people just want an edge over other people in their career. Some don't want to miss the "next best thing". Some people just want to be stay relevant and be employed.
Haha that should be written across the header on the main page.
I also started a JS project in 2015 were the lead dev started 3 months before me with... CS! But he rewrote most of it in ES2015.
Realistically, everybody who uses Coffeescript is/was a Rails developer at some point since the syntax is very opinionated towards rubyists.
The typical Node dev is more likely to use ES6/7 which fixes a lot of the same js issues as Coffeescript.
Whole technologies have been invented simply so that devs can avoid learning or touching JS. Once upon a time, I was one of them.
It's another reminder that no-one knows the future.
It was at the same time I was reading more and more of Resig blogs and books (Secrets of the JavaScript ninja) and I really began to learn and grok just plain normal JavaScript. I said to myself, "you know, this really isn't that bad"
Haven't looked back since. I hate the direction ES is going.
Prototypical inheritance is really not that hard to understand.
I would rather see JavaScript fix the existing functionality, such as sometimes the prototype chain not being correctly established when instantiating a new object.
https://www.nemil.com/musings/shinyandnew.html
Excerpt: Pity the modern web or mobile app developer on Hacker News. As a full stack startup developer in 2012, you were building websites using Ruby/Rails on the backend, Backbone/Coffeescript/Underscore on the frontend, while deploying your app with Capistrano (or the relevant Python analog). By 2013, you'd transitioned to Node/Express/Mongo on the backend, Grunt/Ember on the frontend. In 2014, you'd switched whole hog over to the MEAN stack (now with promises), but experimented with Koa and considered a shift to Go (after the Express core contributor made the jump).
In 2015, you're using Gulp/ES2015/React on the front end, Express/Go on the backend, React Native over the native mobile languages, and slowly transitioning your system over to microservices with Docker. Soon, you'll be transitioning to Phoenix, figuring out if Angular 2 is the right choice - and maybe even plotting a world where Go can work on Android and where an open sourced Swift might fit into your stack. (I’m clearly exaggerating for effect, though this is a fair representation of what is popular in HN headlines)
There is a Stage 1 Null Propagation proposal: https://github.com/tc39/proposal-optional-chaining
https://github.com/babel/babel/tree/7.0/packages/babel-plugi...
However the `a?.b` form is coming (it's not just null propagation, it's an Existence Operator). It's called "optional chaining"
Fine.
s/null/undefined
The problem still exists.
A cleaner syntax is nice for sure, but it’s not exactly unworkable as is (and promotes flatter data, generally a good thing).
But yes, it’ll be nice if/when the new syntax drops.
!== works
I've recently started moving our existing CoffeeScript + React codebase – it's been okay, though I still miss the terse CoffeeScript syntax. A similar blog post that's helped is Bugsnag's: https://blog.bugsnag.com/converting-a-large-react-codebase-f...
- Familiarity. Most of our team have a little experience with Javascript, but none at all with CoffeeScript. It's not that different, but there's still a cognitive overhead.
- Documentation. Almost all documentation for front-end work, especially with React, is in ES6 now. There's an additional overhead in translating it.
- React – CJSX was IMO awesome, but there's no ongoing support for it. Embedding JSX in CoffeeScript is less satisfactory.
- Webpack. We've had various problems getting features of Webpack 2 to work correctly with pre-2.x CoffeeScript – HMR etc. that only really work with ES6 modules. We could wait for CoffeeScript 2, but it's already becoming a drag on velocity.
In short, CoffeeScript was great, but the benefits are much more marginal now. My preference for terse syntax isn't that high a priority for the rest of my team, so I'm happy to take advantage of the more standard ES6 that we can now use.
I'm going to miss CoffeeScript, but being able to use ES7 features (notably async/await) is worth it.
With decaffeinate@3, you can convert using ES2015 module syntax with the `--use-js-modules` flag.
Although we don't plan on using CoffeeScript for the reasons outlined in the article, I do want to mention CoffeeScript 2 does aim to target ES.next features and offer interoperability. Specifically, CoffeeScript 2 does support async/await http://coffeescript.org/v2/#async-functions.