DEV Community

Discussion on: Why do people like Ruby?

Collapse
 
rpalo profile image
Ryan Palo

I hated Ruby the first time I tried to learn it (coming from Python). I think that the main reason was that I tried to learn Ruby and Rails all at once, diving right into Rails without getting a solid Ruby foundation. I also hated the magic and the voodoo that you had to just "assume it worked."

So I gave up.

I came back to try it again about a year later, because I really wanted to like Ruby. This time, I started with Ruby Monk, which is a great way to learn because it teaches you to do things "The Ruby Way(s)." You learn that there's not really "magic," just that some things are implicit, but predictable. Things like, "you can call a function like puts('hello') or puts 'hello', and both are OK. Once I had a solid foundation, Rails made a lot more sense, and I could see through and behind the magic. I didn't have to trust that it was working, because I knew what things were doing behind the scenes.

Now, I love Ruby! I love it because it can take really complex tasks, processes, or concepts and the code comes out looking like what you might say out loud when explaining it to your little rubber duck friend. Ruby is the only language that I've written in that I finish a block or a method and just get this feeling of

Mmm... just right.

Ahhh... that's nice. Like when you smooth the sheets on a bed down just perfect and everything is flat and smooth and all is right with the world. (Okay, maybe that example says more about my personality than how nice Ruby is, but hopefully you get the idea.)

fruits = ["apple", "pear", "bananana", "orange"]

puts fruits.sort_by { |item| item.length }
            .map { |item| item.upcase }
            .select { |item| item.length.even? }

# => PEAR, ORANGE, BANANANA
# I know banana has too many na's.  I did it for the sorting to be pretty.
Enter fullscreen mode Exit fullscreen mode