5 ms·
This is just an anecdote as: - I agree that most rails programmers will not move to clojure. - For monorail apps, rails is still king. That said, for us, whe
by erichmond 11y ago
This is just an anecdote as:
- I agree that most rails programmers will not move to clojure.
- For monorail apps, rails is still king.
That said, for us, when comparing clojure and ruby REST API services we've built, clojure has had the following benefits:
- Less code
- Less tests needed
- Better concurrency
- Less developer hours
- Less maintenance
- About 33% of the servers for same performance
- Easier/faster debugging
It's been far more then a 10x improvement overall, and if people are looking to move out of the monorail style of app, it's definitely worth a look.
- matthewmacleod 11y agoInterestingly, we had a couple of Clojure experiments. Takeaway was that there were some benefits in terms of performance and maintenance, but they weren't worth the tradeoff in expressivity and increased developer time. There's no reason that Rails should be restricted to 'monorail' or monolithic apps. We've had great success writing what are essentially microservices in Rails. Code is easy to read, easy to maintain, and performs well. It's hard to find any compelling reason to use another toolset under those circumstances!
- erichmond 11y agoI appreciate the counterpoint! I guess just another example of different strokes for different folks. For us developer time decreased, and expressivity increased. I wasn't suggesting that rails shouldn't be used for microservices, we actually have a number of rails microservices in production as well. I was more stating that I agree with OP in that if I were to write a monorail style application today, I would use ruby/rails over clojure. I was also pointing out that if you are moving to more of a SOA/microservices framework that we've had great experience with clojure, and that it's worth looking at. I'm a huge fan of rails, and have been using it since pre-1.0. I think as we look back on this period in time, we're only going to appreciate rails more and more for really making self / low funded startups viable. Cheers!
- matthewmacleod 11y agoA great point, of course. That's why we had a crack at Clojure in the first place! Basically, it's great to have a diversity of freely-available, open-source tools that can be used for such a wide variety of different tasks. I expect the 'my toolset is better than your toolset' nonsense will always be with us, and while it's useful to discuss some of the pros and cons, we should all bear in mind that most tools are awesome :)
- kyllo 11y agoIf you feel Clojure is less expressive than Ruby, you're not good enough at Clojure yet. I'm not saying you have to prefer Clojure's syntax, and Ruby probably has more libraries for a lot of things you want to do. Going from Ruby to Clojure may be a productivity tradeoff for you and your team, but objectively it's not an expressivity tradeoff. Clojure has a bit more expressive power than Ruby.
- davidann 11y agoCould you reference examples of this assertion please?
- kyllo 11y agoI think the biggest reason would be Clojure's macro system. The code itself is an abstract syntax tree that you can rewrite in arbitrary fashion at macro expansion time. There's a good example here of how Clojure's macros are more powerful/expressive than Ruby's instance_eval and class_eval: http://daveyarwood.github.io/2014/07/09/whys-guide-to-ruby-in-clojure-part-5/ http://daveyarwood.github.io/2014/07/09/whys-guide-to-ruby-i... And here's an attempt to objectively rank programming languages by expressiveness, measured as lines of code changed per commit: http://redmonk.com/dberkholz/2013/03/25/programming-languages-ranked-by-expressiveness/ http://redmonk.com/dberkholz/2013/03/25/programming-language...
- akmiller 11y agoNot sure what examples the author was thinking of but functional lisps tend to be extremely expressive just because of their nature. If there is expressiveness you are missing the language can be molded in ways that are simply not possible in non-homoiconic languages.
- davexunit 11y agoEasy. Ruby doesn't support syntactic abstraction via macros. No, 'eval' doesn't count.
- danneu 11y agoI think it's pretty uncontroversial to suggest that Clojure is more expressive than Ruby - without even getting into macros. Just take run of the mill Ruby code and convert it to Clojure. Especially anything that looks like functional programming.
- klapinat0r 11y agoMonorail? Do you mean monolithic? or do you mean "doing only one thing" (one track)?