3 ms·
I love Ruby. As the saying goes, It was developed with programmer happiness with mind. Once you learn more than hello world, you start to see there is actual jo
by beeburrt 3y ago
I love Ruby. As the saying goes, It was developed with programmer happiness with mind. Once you learn more than hello world, you start to see there is actual joy to be had in programming in Ruby.
- shermantanktop 3y agoIt was developed with the happiness of a particular type of programmer in mind. No matter how much Ruby I learned, my experience had more irritation than joy. I had many experiences where a Ruby fan would condescendingly explain why a friction point that I was experiencing was actually a good thing, with the implication that I was apparently too stupid to see the light. Now I never write Ruby unless I can't avoid it. But I know people who love it, as you seem to, which is great...but not a universal sentiment.
- the_sleaze9 3y agoI'm curious - can you give an example of a pain point?
- tenacious_tuna 3y agoI've come to really loathe how there's ! and not-! versions of otherwise similarly named methods. It's such a sneaky, small difference and it's caused several bugs in the codebase I work on. Also the "last statement evaluated is what's returned" behavior leads to super not obvious data flows sometimes which is similarly frustrating. A lot of ruby's philosophy seems rooted around doing away with what looks like redundant code at a severe cost to readability / adding significant cognitive load, in the name of "elegance," and that drives a LOT of my frustrations with my org's ruby codebase.
- kayodelycaon 3y agoThere’s a method to the madness. Which I’ll explain a little for others. :) If you see ! on a method it means one of two things: 1. The method modifies the object in place in and may return nil if no change is made. This is what the Ruby standard library does. 2. The method throws an exception when there’s an error. Usually there’s a non-! version that returns nil or false instead. Rails made this a popular option. Ruby likes to provide everything so there are methods that return new objects and there are methods that modify objects in place. And there are a lot of methods to do almost everything you can think. Which tends to make Ruby code more compact. But you have to keep the documentation handy until you’ve learned them because the method names are odd. The designer of the language it’s not a native English speaker. The if keyword returning a value takes some getting used to. You never see a for loop because you pass code blocks to iteration methods. This kind of thing is all over the language. You don’t need parentheses on method calls, which means you need to know if you’re dealing with a local variable or an instance method. Another thing is Ruby allows code to be far more compact. Doing the same thing in python may require two to ten times the amount of lines. But if you can’t read Ruby code quickly and follow what happening, any advantage compactness might have becomes an exercise in frustration. All in all Ruby a bit of an odd language. I personally find it an absolute joy to work with, but a lot of people very justifiably do not have the same opinion. :)
- tenacious_tuna 3y agoThis actually helps me understand some aspects of the language that have been frustrating me, thank you! > Another thing is Ruby allows code to be far more compact Yes, this I've definitely noticed, and I do really like. The block syntax and proliferation of functional-style stuff is an absolute joy... most of the time. It fits the style of how I like to think about problems, and lets me move very quickly for writing code, but I often find myself confused about what existing code does, and it takes me a while to load the context into my mind when I'm working on something. I think that's because while other languages (like Python) tend to be more verbose, that verbosity leaves room to explain what's going on more clearly. I'm not saying verbosity is always a good thing--I've written enough Java to know that, but I do sometimes find myself wishing there were more 'clues' in the ruby code I deal with to help understand what's going on. Not needing parenthesis and general strangeness around value returning doesn't help, either. Again, I see how it makes code more compact, and that can be a good thing (fitting more relevant code on the screen at the same time), but inasmuch as understanding what's going on quickly, sometimes I wish there were a few more markers :)