6 ms·
Things I dislike the most about Ruby: - Raw performance - Runtime metaprogramming from hell - Monkey patching - No real concurrency support, tons of non-thr
by iagooar 9y ago
Things I dislike the most about Ruby:
- Raw performance
- Runtime metaprogramming from hell
- Monkey patching
- No real concurrency support, tons of non-threadsafe code and gems
- Too Rails-centric
- Little presence outside web development
- Little to no real innovation in the last years
- Mutability
- No optional / progressive types or type annotations
===
Things I love about Ruby:
- Clean syntax
- Although it's object oriented, it allows using a functional style
- Functional collection operations
- Productivity
- Flexibility
- Maturity
- Availability of high-quality libraries
- Availability of hosting solutions
- Friendly community
- Nice stack traces
- thibaut_barrere 9y agoAs usual, it's all about tradeoffs. I use other languages too (Elixir, a bit of Rust, Go, Javascript etc). When the tradeoffs match your needs, Ruby is excellent. But then addressing your points: - Raw performance is improving (see my other post) - Monkey patching is less and less frequent (I'm maintaining pure Ruby, but also Rails app since 2005), is generally considered a bad practice - Rails-centrism is gradually becoming a thing of the past (see gems like Hanami, Roda, Sequel, Kiba, dry-rb etc) - Runtime metaprogramming brings a lot of benefits when properly used! - Threadsafety (I'm the first to mention that) has gradually gotten much better So well - we're getting somewhere!
- RangerScience 9y ago"Refinements" are the "cleaner" version of monkey-patching. These are (AFAIK) a big part of the magic in Ruby testing frameworks.
- semiquaver 9y agoApologies if I'm wrong here, but I don't believe any of the major ruby test frameworks use refinements at all. Since they are lexically scoped they end up being too verbose to be useful for this purpose. In other words, you would need to have a series of `using MyRefiningModule` statements in every single test file. Perhaps you were thinking of rspec's changes in the last few years. They have been moving away from monkeypatching with some changes to their syntax. Previously they defined `Object#should` and handled assertions using syntax like `my_var.should eq(1)`. The new approach, which does not use refinements, is to handle assertions using a wrapper method that works like `expect(my_var).to eq(1)`. No refinements necessary for that though.
- eropple 9y agoAs I often note when this comes up, I've never actually written a Rails app. I've been writing Ruby for about five years now. A huge chunk of the devops world is written in Ruby (probably about the same in Go, much less in Python). It's still the "Perl of the future" and you'll find it all over the place. Rails is still big, especially in America--but there's a lot of other very influential stuff to it. If you're doing web there are other (I would say better, unless you're making Basecamp) libraries that do very well, too. Hanami is cool, Grape is good, and I'm in the process of building a Rack framework called `Modern` that's intended to be a turn-key, OpenAPI3-compatible framework to make the creation of API clients on the other hand a trivial experience.
- fhood 9y agoI agree with every point here except for clean syntax. You can make Ruby's syntax almost as nasty as you want to. I think syntax flexibility is simultaneously one of Ruby's best and worst features.
- pqh 9y agoThe stack traces suck sometimes with the metaprogramming. I have never chased down exactly what causes it, but sometimes you'll have lots of library code calls mentioned, and nothing from the application.
- TomK32 9y agoThe Rails-centrism is only a western phenomenon, in Japan the focus for using Ruby is a very different one. http://engineering.appfolio.com/appfolio-engineering/2017/5/24/how-is-ruby-different-in-japan http://engineering.appfolio.com/appfolio-engineering/2017/5/...
- busterarm 9y agoRuby developer in the west here. Stopped using Rails in my professional and personal work pretty much immediately on starting my career (not saying that I wouldn't use it). My last web projects were all Jekyll. 99.9% my work involved (past tense, I'm a Systems Engineer now) ETL processes and Ruby is a serious workhorse there. I've done extremely complex jobs in plain Ruby, the Kiba DSL or just using Ruby to augment/encapsulate shell commands (ruby script in crontab->curl wrapper[typhoeus] to fetch data & write to file->%x(some grep/sed/awk stuff)->do more work with output in ruby). I've never found better tools for doing this kind of work. I've seen some _nightmarish_ Node or Python projects to do similar. It's very, very rare that Ruby and its performance are my bottleneck doing this kind of work. Usually it's platform (ahem...Salesforce) or database limitations. GNU Parallel fills in the gaps usually. Ruby is the only language I've found where I can consistently hand off my work to others. They comment on the code being clean and they keep it clean with their changes.
- busterarm 9y agoJust to add a funny story: The place I just got hired by is pretty much all Python. They half-joke about hating Ruby. I did all of my challenges/problem walkthroughs in Ruby because I felt like it best communicated the problem and problem solution in code. The number of times I heard "that solution is so clean" or "this solution would be way more involved in Python" from my interviewers would take more fingers to count than I have hands.
- justatdotin 9y agoso, 3?
- 9y ago
- tomc1985 9y ago> - Little to no real innovation in the last years You are sooooooooooo wrong it isn't even funny. I'm stuck coding to Ruby 2.2 and Ruby 2.5 is looking more and more like a totally different world. > - Mutability Never understood this complaint from people. I just recently started playing with a language that supports immutability (Kotlin) and it is weird to me that you guys seem to be asking for constants, rebranded. Even weirder is if I write my vars' names in CONSTANT_CASE I get yelled at by the code formatter! Plus, in immutable languages, are there cases where immutability extends to nonscalar values like arrays or hashes or objects? That distinction just feels so...arbitrary. Is data changing that big of a problem?
- busterarm 9y agoThe last 3 years of development to the language have been...momentous, to say the least. Even if you just look at what's been done in garbage collection alone, it's leaps and bounds.
- thedufer 9y ago> Is data changing that big of a problem? Yes, but it is hard to recognize it as such until you've experienced the alternative. I don't know much about Kotlin, but the fact that it relies heavily on Java libraries is sufficient to tell me that it is a particularly poor example of the power of immutability. You see the usefulness of immutability when you have objects that are deeply immutable - when you pass them around, you know those functions haven't changed them. It is much easier to reason about deeply immutable objects than mutable ones. > in immutable languages, are there cases where immutability extends to nonscalar values like arrays or hashes or objects Yes, this is largely the point. Although, you will rarely see an immutable array or hashtable - more likely it will be a linked list or balanced binary search tree.
- tomc1985 9y agoYou're probably right, Kotlin's version of immutability is perhaps not the best example -- pretty sure the whole var/val thing is language sugar which explains why it doesn't work for nonscalars. Makes sense, I can see the appeal now. Thanks
- mmanfrin 9y agoI think a lot of the problems with Ruby are really problems with the nature of Rails jobs over the past 5 years. Lots of juniors (which is great) in a field where people change jobs every year or two (which is okay, but horrible from a codebase standpoint). Giant monorails applications grow strata of different generations of code/teams/opinions; and each new generation of engineer on the project adds their own stamp on top. It leads to situations where you have enormous applications that are so deeply entagled within themselves that it becomes nearly impossible to refactor out poor performing bits of the app. It reminds me of the Kowloon Walled City[1] -- originally a (likely cleanly built) fort that took on more and more people until it became a morass of people and buildings with no consistency or strong structural concerns. Then Rails (and Ruby) get this reputation for being a Kowloon rather than the Fort. Not that ruby is not slow compared to other languages, but it's not as slow as perceived. [1](https://en.wikipedia.org/wiki/Kowloon_Walled_City https://en.wikipedia.org/wiki/Kowloon_Walled_City)
- barrkel 9y agoI've found Ruby to be faster than Python these days; it's node.js that beats it, for obvious reasons. I don't think JS has fewer problems around mutability and and monkey patching though.
- paulddraper 9y agoAre you talking about CPython or PyPy? MRI, Rubinius, JRuby? Perf characteristics differ wildly between those.
- ksec 9y agoOn Walled City It wasn't really cleanly built. And there are lots of stories in there. And the Japanese seems to love it. I always wonder if someday we could rebuilt the whole thing as Hotel, resort and tourist attraction.
- philipov 9y agoAll those positives sound like python.
- iagooar 9y agoThat is something to be proud of. I've always considered Python one of the most mature and powerful languages out there. If Ruby has reached that level, I'm honestly very happy.
- metacontent 9y ago* Raw performance Last time I checked I think that Ruby is faster than Python, and people generally seem to be okay with Pythons speed so I don't really think Rubys speed is as huge an issue as people make it out to be. Also, if this project that the OP mentions eventually realizes it's potential Ruby could become substantially faster than it is today. It will never approach JavaScript or Lua speeds, but faster is always better. * Runtime metaprogramming from hell, * Monkey patching Isn't this really the users fault though, just because the language allows bad stuff to happen doesn't mean we should ever do bad stuff. * Little presence outside web development Do yo consider NetSec to be web development? Because I've noticed Ruby is fairly active in NetSec but it doesn't get talked about a lot. I've also heard that Ruby is used extensively in embeded devices in Japan but due to the language issue it isn't known or discussed anywhere else. I'm sure there are other weird little corners as well that Ruby is active in but that just aren't really know.
- paulddraper 9y ago> Last time I checked I think that Ruby is faster than Python Really? When did you look? PyPy has gotten pretty stinking fast.