Using CoffeeScript in a production environment [closed]
I really like using CoffeeScript (1.1.1) for small projects and it worked out great so far. However before using it in a more broad environment I would like to hear second opinions on using it in production.
So my questions are:
- How stable is the language itself?
- Do I need to watch for upcoming changes which will break my code?
- If the answer is yes to the question above: how well are older versions supported?
- Is there a stable (bug-fix only) and a separate development branch?
- If you already did use CoffeeScript in your product/website/etc please describe the scope in which it was used and your overall experience.
Thanks!
Note: I've already heard that "CoffeeScript support will be included in Ruby on Rails version 3.1." (Wikipedia) which is great because of the additional backing from the Rails community.
The language has been stable for the last six months (1.1.1 is basically just 1.0 with bugfixes). That's no guarantee of future stability, but I don't expect my book to be totally obsolete any time soon.
I'd say the best practices for avoiding version issues are
- Make sure you document the version of CoffeeScript that your project was written for, and
- Compile to JS under that version and keep the JS stored somewhere
- Have good test coverage (in the words of Samuel Adams: Always a good decision!)
That way, when a new version of CoffeeScript is released, you have a JS backup to use in case your CoffeeScript code is broken. Breaking changes are a pain, but they're a pain common to nearly all languages except JavaScript—just ask a Rubyist who recently made the transition from 1.8 to 1.9, or a Pythonista who's still migrating their Python 2 code to Python 3.
The advice I can give for preventing your code from breaking under CoffeeScript version changes is to avoid syntactic edge cases. For example, func a:b, c
used to mean func {a:b, c:c}
, and now it means func {a:b}, c
. That's an improvement (the old behavior was considered a bug), but some folks were caught off-guard by it. So use explicit punctuation whenever there's a hint of ambiguity; it makes for more readable code anyway.
Jeremy will have to comment on the stable
/master
distinction, since both branches exist but stable
hasn't been updated since April (pre-1.1.0).
Check this: Has anyone used Coffeescript for a production application?
精彩评论