DEV Community

Cover image for Why do you love Ruby, actually? An ode.

Why do you love Ruby, actually? An ode.

Sylwia Vargas on February 21, 2021

✨ tl;dr ✨ I love Ruby and I'm curious to learn what makes it special to YOU (and if/what other languages you know to see what your point of compari...
Collapse
 
leob profile image
leob

Totally understand about the good points of Ruby, however don't count out PHP - it's got a lot better, and it's a much nicer language nowadays than it used to be, especially with "Rails-like" frameworks like Laravel !

Collapse
 
zacharythomasstone profile image
Zachary Stone

Yes! Laravel makes PHP so much better. I've worked with both PHP without Laravel, cleaning up a nightmare application where the dev had multiple methods of the same exact code copied and pasted everywhere, and then went to a PHP project with Laravel (and devs using clean code pursuits haha) and it was night and day.

Collapse
 
leob profile image
leob • Edited

Yes I'm with you there, hundred percent, difference of night and day ...

PHP pre-Laravel tended to be a hackish, sort of an old-school "Perl" style mess, but if you look at code written in Laravel style - most of it is elegant, succinct, "OO" and so on ... I also tend to prefer Laravel's utility methods like \Arr, \Str and so on over PHP's built in methods just because of their logic and elegance ... and Laravel's collections are superb (plus the Eloquent ORM, and I could go on).

I agree that Laravel seems to have really transformed the PHP world - maybe you cannot solely credit Laravel for that (there have been other positive developments in PHP) but it's a big (if not the biggest) factor in that transformation.

Thread Thread
 
sylwiavargas profile image
Sylwia Vargas

Oh, interesting — what are other positive developments in PHP? Or, is there a blogger I could refer to to catch up on PHP news? :)

Thread Thread
 
leob profile image
leob

Well, performance is MUCH better than it used to be, PHP 7 and 8 made big strides in performance ... one other remarkable change is the move of PHP towards typing - type declarations/type checking.

Blogs, well of course there are many, we talked about Spatie, so here you go: spatie.be/blog

What's new in PHP 8:

stitcher.io/blog/new-in-php-8

Thread Thread
 
sylwiavargas profile image
Sylwia Vargas

Cool, now I’m excited! I’ll give it a try and report back ✨ thank you!

Thread Thread
 
leob profile image
leob

Haha okay, yes you should be!

Laravel is a great framework with a lively community & a vibrant ecosystem, they're innovating a lot - for example, recently I came across a version that runs "serverless" on AWS Lambda (vapor.laravel.com), check it out if you're into that kind of stuff.

And remember the name Taylor Otwell, he's the creator (twitter.com/taylorotwell), you'll see him mentioned quite often.

Collapse
 
sylwiavargas profile image
Sylwia Vargas • Edited

the dev had multiple methods of the same exact code copied and pasted everywhere

This does sound like a nightmare — and it's exactly what I understood PHP to be. I'm happy to learn that there is a better world out there! I'm excited to explore it. Thank you!

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Oh really? Interesting, I'll give it a try, then. I was very discouraged by everything I saw so far from PHP and I'm happy to discover my own ignorance there. Are there any Laravel authors/devs that you'd especially recommend I check out if I'm just beginning there?

Collapse
 
antergos98 profile image
Vincent Bergeron

You should check out spatie and beyond code. They are building really great packages for the Laravel ecosystem!

Thread Thread
 
sylwiavargas profile image
Sylwia Vargas

Thank you!! I’ll check it out!

Thread Thread
 
leob profile image
leob

Ah right, yes Spatie is a good example of folks building nice stuff in the Laravel community!

Collapse
 
fduteysimfinity profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
fdutey-simfinity

No, still the same pile of garbage with unpredictable behaviour and full of exploits under the hood

Collapse
 
leob profile image
leob • Edited

Oh, really ... proof? Anyway I'm not going to enter into this sort of discussion, the only thing I know is that it's a useful tool and people get stuff done using it, nothing is perfect but millions of users/devs can't be that wrong.

Thread Thread
 
fduteysimfinity profile image
fdutey-simfinity

Always the same "argument" (because there is no other): "mumumu, lot of people use it so it's good"

en.wikipedia.org/wiki/Argumentum_a...

Thread Thread
 
leob profile image
leob • Edited

Okay, what's the quality of your argument then? I don't have a nice Latin proverb to characterize it, but maybe "baseless claims" will do. I didn't say that I like PHP because "people" are using it or "everybody" is using it, it's because I'm using it productively myself and because I'm getting stuff done with it ... couldn't care less really about all of these language/stack/platform "mine is better than yours" wars.

Collapse
 
yechielk profile image
Yechiel Kalmenson

What a great post!

Ruby was the first language I learned, and the one that caused me to fall in love with programming! I even got to meet Matz personally at RubyConf 2017 and thank him personally!

Unfortunately, I never really got the chance to work with Ruby professionally, but it's still my first love and my go-to for personal projects.

Maybe one day... 🤞

Collapse
 
sylwiavargas profile image
Sylwia Vargas

WOW! So ironic that while you are known in the tech online community for your expertise in Ruby and Rails, you don't get to code in it professionally. In all honesty, when I had some gloomy moments a year ago, I thought that I could make my life more beautiful by switching full-time to Ruby, "just like Yechiel" — the power of personal brand 😂

I was supposed to go to RubyConf last year but the pandemic happened. Oh well.

Collapse
 
yechielk profile image
Yechiel Kalmenson

Lol oh man! I chose Rabbi on Rails for my blog when I was at Flatiron because the pun was too good to pass on, little did I realize how much it would define me years later 😅

Thread Thread
 
sylwiavargas profile image
Sylwia Vargas

You know, it's not like you haven't written AMAZING posts about Ruby/Rails recently 😂 I don't think it's solely the nickname but your general expertise and passion for the language 💖

Thread Thread
 
yechielk profile image
Yechiel Kalmenson • Edited

Thanks! That means a lot coming from a great teacher of Ruby like you!

Collapse
 
yechielk profile image
Yechiel Kalmenson

Hopefully we can meet up at RubyConf 2021? 🤞🤞🤞

Collapse
 
emanuelhfarias profile image
Emanuel H. Farias • Edited
def adult?
  age >= 18
end
Enter fullscreen mode Exit fullscreen mode

Simplicity, just the necessary words to be easy to read.

No return keyword.
No self.age to access instance attributes/methods.
No weird method names (like isAdult).

Trying to do the same in other languages seems that I'm writing unnecessary symbols.

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Ruby is so readable and clean 💖
Thank you for this example, it is something everyone can understand from the get-go.

Collapse
 
jenbutondevto profile image
Jen
for (let counter = 1; counter <= 5; counter++) {
 console.log("This could be better.");
}
Enter fullscreen mode Exit fullscreen mode

x.do is probably more similar to

let i = 0;
do {
  i += 1;
  console.log(i);
} while (i < 5);
Enter fullscreen mode Exit fullscreen mode

In terms of English, it reads the same as the ruby. "Do this block of code, while this condition".
It's a bad comparison.. I don't think I have ever needed to do something like this in js. If for example, I know I should do something 5 times based on the length of an array, I would be doing myArray.forEach((item, index) => {....}). (I imagine this is the equivalent of each_with_index you mention too).

I also find ruby, python and the like difficult to read because there aren't braces!! Creating a new instance of a class in a lot of languages look like this let jen = new Person("Jen") which is more "like English" over Person.new "Jen".

Some of your examples for array manipulation do look complicated, but they're quite outdated. Newer versions of ES, and libraries are a lot nicer to work with.

I get why a lot of people love ruby, unfortunately I don't see/benefit the upsides since I've been writing js for a while now. Some of the things you mention can be easily remedied, and really I don't see very much any more. If you're writing JS in an OO way, then SOLID is 100% possible, and is quite common. IDEs and linters will weed out anything that isn't SOLID. But it's quite common to see JS written in a FP way - especially now that React is pushing for more FP, and serverless code.

I used to hate JS for a long time. ECMA6 and beyond had made it a joy to write though.. saddens me to see JS slander heh

Collapse
 
sylwiavargas profile image
Sylwia Vargas • Edited

Thank you for taking this time to write this comment. I totally feel what you’re saying.
My second love is JS (and especially React) — in fact, majority of my work has been done in JS. The examples I chose were definitely tongue-in-cheek and I’m sad that this was not more apparent. Well, maybe inspired by my post you’ll write a similar on about OOJS, just like I did in response to my friend 😂

I’m not here to dispute which language is better or more effective, or to “convert” anyone. As you see in the last part of the post, the real reasons why I love Ruby are subjective and personal and it’s fine if you feel another way about it!

Collapse
 
cescquintero profile image
Francisco Quintero 🇨🇴

I think it depends on the background. In my case, English is my second language and I learnt programming in Spanish. So when I see:

for (let counter = 1; counter <= 5; counter++) {
 console.log("This could be better.");
}
Enter fullscreen mode Exit fullscreen mode

I kind of read it literally: "define variable, control condition and make sure it's increased"

While with:

5.times do
  puts "something"
end
Enter fullscreen mode Exit fullscreen mode

I read as: "print something five times".

It's just like reading some text.

I don't want to mean disrespect to JS because I've worked with it and it's nice but I think Sylwia made a good point.

Collapse
 
olivierjm profile image
Olivier JM Maniraho

I started working with ruby about a year ago when I joined a company that was using ruby on rails, I had no prior knowledge in ruby but it only took a few days to get acquainted with the syntax.
Since then I have found so many things in ruby that just amaze me and simplify my life on a daily basis.
It is also worth noting that writings tests in ruby is way easier than in most other languages and I am yet to find a lib in other languages that magically works like search_cop.

Collapse
 
sylwiavargas profile image
Sylwia Vargas

TESTS! I forgot about how fun and stress-free testing in Ruby is. Thank you. Maybe this is going to be next blog material.

Do you have any Ruby favorite tricks and tips? Any method(s) that deserve special appreciation?

Collapse
 
olivierjm profile image
Olivier JM Maniraho • Edited
  1. Accessing models and their methods in the rails console is one of my favourite
  2. Date methods are arguably the best, there is just no way Time.now.tomorrow, Time.now.yesterday, or using .first, .second(I remember I told so many people the first time I found this)
  3. There is just so many methods out of the box that are very useful

I took me a bit of time however to grasp the unless this do that or return this if that then another statement after this.
I still use rails for any new projects I create

Thread Thread
 
sylwiavargas profile image
Sylwia Vargas • Edited

DATES. That's another one that I forgot — and such an easy one to contrast with JS:
browser console showing inconsistencies of date logic in JS

It's interesting that you mention this syntax as baffling for you:

unless this do that or return this if that

For me this is the specific feature that felt like I'm playing with lego. When I later learned JS, I've developed a strong preference for refactoring if/else statements this way as well and literally everyone compliments me on this :D I wish all JS devs were trained in Ruby first so they'd write less of a spaghetti code.

Thread Thread
 
olivierjm profile image
Olivier JM Maniraho

It took me a while to grasp it but once I understood it I really loved it. Thanks for the article it looks interesting.

Collapse
 
devimposter1 profile image
devimposter

To be honest I tried to get into Ruby many years ago and didn't click with it. Surprisingly I am really enjoying Elixir though that is supposed to have some similar syntax. PHP, JS and C# always came more naturally to me than Ruby. Just an opinion...

Collapse
 
sylwiavargas profile image
Sylwia Vargas

I’ve heard amazing things about Elixir and I’m curious to check it out!

Different things click for different folks ¯_(ツ)_/¯

Collapse
 
masilver99 profile image
Michael Silver

Great post. It's definitely wonderful having a variety of programming languages and Ruby has certainly had an impact. Rails also pushed web development forward a notch or two as well.

Sadly, I'm here representing the evil empire and their offspring, C#. While opinions abound, I think there is an excellent argument for it being one of the best languages ever written. It is constantly changing and making my job easier and more fun.

Regardless of whether it's Ruby or C#, at least we found something that brings us joy. That's a win for everyone.

Collapse
 
sylwiavargas profile image
Sylwia Vargas

I agree! I would love to one day learn some C# but now I’ve just taken up Go (and next will be laravel following the recommendations of the folks in this thread).

Collapse
 
gdledsan profile image
Edmundo Sanchez

I have been writing some JS and a lot of Python due to company preferences, I keep wanting to go back to ruby everytime something is overly complicated.

however my levels of overly complicated are now quite sensible because of Ruby, ruby truly cares about you as a rubyist and your happiness and makes so much things easier, I really like that about Ruby.

I miss ruby.

Also, you made me look up the 10xEngineer again, I got angry, I might write some ruby to feel happy again.

Collapse
 
sylwiavargas profile image
Sylwia Vargas

I love this comment! You made me laugh 😂

ruby truly cares about you as a rubyist and your happiness and makes so much things easier, I really like that about Ruby.
I miss ruby.

^ that is soooo relatable. I also work a lot with other languages and frameworks and Ruby projects always feel like a safe happy place I can come and breathe. In the darkest moments when debugging the spaghetti code, just think about Ruby 💖

Collapse
 
pinotattari profile image
Riccardo Bernardini

making pointless comparisons to another language (JavaScript, for instance, which is always an easy target)

😂 This brought to my mind the Italian commercial "Ti piace vincere facile" (it is not 100% correct Italian, quite similar to "You like to win easy," error included).

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Thank you for this! I just watched this commercial 😂

Collapse
 
jafuentest profile image
Juan A. Fuentest Torcat

The syntax. It's so beautiful... I've used many languages over the years and none is easier to read than Ruby, that's just so important when you have to debug other people's code. I started learning Ruby because of college project using Rails like 10 years ago and it's been my preferred framework for web apps and APIs.

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Wow! If only I came across rails 10 years ago! I’m happy that you got a decade of kindness ✨
Thank you for this wholesome message

Collapse
 
ericchapman profile image
Eric The Coder

I learn Ruby after reading about it in many blog. At first it was just a curiosity because my favorite language was Python, but the more I learn the more I fell in love... Only couples day after learning my fist Ruby methods, I convinced my partners to switch our already started PHP project to Ruby on Rails :-)

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Wow that is fantastic! I’d be curious to see that project if you can share! I’m always excited to interact with fellow Rubyists and their code!

Also, a follow-up question: what made Ruby different for you from Python? And how did you “sell it” to your partners?

Collapse
 
ericchapman profile image
Eric The Coder

My « sell » pitch was something like developer happiness and dev speed = project done quickly and with more goodies :-) Since this project need many overtime hours I ask to work with tool I love...

Thread Thread
 
sylwiavargas profile image
Sylwia Vargas

“tool I love” 💕 exactly!

Collapse
 
alexlion profile image
Alex Lion

I discovered Ruby along with Rails a year ago, this has literally rekindled the flame of passion for development.

I come from the JS and Java world, JS ecosystem is too messy and changing caused me the famous "JS fatigue". Java is too boilerplate.

It has been a challenge to change my way of thinking and in the end be much easier to understand and make me happier.

I've a lot to discover yet.

For PHP, Laravel is inspired by Rails but the language is too "arrowed" and not very pleasant compared to Ruby language. However Laravel has a lot of satellite projects like Nova, Forge, Vapor, Telescop which Rails is missing.

Ruby forever <3

Collapse
 
sylwiavargas profile image
Sylwia Vargas

I totally know what you mean about rekindling passion for development.

Whenever I get back to Ruby after working on a JS or React project, I always feel like some weight has been lifted off my chest.

I think I always worried of being a “declared Rubyist” because there’s just so much 10xEngineer attitude on tech twitter that bashes Ruby and Rails. But in all honesty I love React because of the features it shares with Ruby (straightforward syntax, inclusive community) so yes, Ruby is my love language 🥰

Collapse
 
rlc900 profile image
Rianna Cleary

This such an amazing blog, Sylwia! I love how Ruby is so inclusive and is such a user friendly language. I remember being so scared when I was switching to JS from Ruby because I didn't want to move away from the friendly error messages or syntax 😣 I know that whenever I switch back to Ruby it'll always have my back ✨

Collapse
 
sylwiavargas profile image
Sylwia Vargas

✨ friendly and inclusive ✨ yes, I can't agree more. It just makes my life so beautiful.

I feel passionate about React as well but... every time I get back to writing Ruby, I feel like I'm on the phone with a warm fluffy friend and we are eating chocolate chip cookies while chatting about code 💖

Collapse
 
marklewin profile image
Mark Lewin

This is a lovely post, Sylwia! I feel inspired to take another look at Ruby after reading your love letter to the language :)

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Thank you, Mark ✨
Helping people experience Ruby joy is my most favorite side project.

Collapse
 
rsmithlal profile image
Robert Smith • Edited

The kindness of the Ruby community is one of the reasons that I have grown to love Ruby so much! The whole experience of programming in Ruby is much more enjoyable for me than Python or JS (which I also use regularly for my job).

I personally find that the Ruby language and Rails ecosystem are more in line with how my neurodiverse brain naturally thinks and solves problems. It's really interesting that you mention the easy of use and low cognitive burden as a big plus for Ruby. I have ADHD, and I never considered that this might be one of the reasons why it feels so much easier for me to express myself using Ruby than other languages. There is less to get in my way when I'm exploring concepts and working through problems!

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Thank you for this comment. Whenever I'm in a teaching role, I try to always acknowledge how different folks have different learning styles and learn at a different pace — or, I'm trying to design assessments in a way that would not disfavor neurodiverse or just anxious/tired folks. Accessibility (broadly-understood) is something I care deeply about. However, I never thought about that Ruby with its strong preference for convention over configuration and friendly methods actually also helps folks succeed 💖 yet another reason to love this language ✨

Collapse
 
saraid profile image
Michael Chui

My personal reason is "expressivity". When I write Ruby, I feel like I'm writing poetry: trying to maximize how much I can say with very precise terms. Communication matters a lot to me, more and more as I grow both professionally and personally, and Ruby's one of the few languages where wanting to be able to say something differently is not only completely okay, but also not superficial.

Through refinements and permissive syntax, I regularly write new DSLs just because I think that's the best way to communicate. I can pare away all the irrelevant stuff and be clear and precise in what's going on for the sake of both people reading the code and the computer.

I enjoy it a lot. I don't really need it to be the fastest or the most math-y or whatever. It just works really well for me. Thank you for writing this post and giving me a reason to put this into words!

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Thank YOU for your comment and sharing your thoughts.

It's funny that you mentioned poetry. Right before reading your comment, I tried to describe to a non-tech person why I love Ruby so much. I said that it looks pretty and you need to be very intentional about your code design to follow SOLID. "It sometimes feels like writing haiku", I added.

Speaking of poetry and code, have you heard of ./code --poetry? It's a super-fascinating project!

Collapse
 
saraid profile image
Michael Chui

I had not heard of it. That's pretty cool.

Collapse
 
henry701 profile image
henry701

While I agree with all the points in the post, I feel the OP should take a look at the new C# & .NET features. It also has almost everything good that was exposed about Ruby in the post.
Operator overloading, useful utility methods in LINQ, async as a first-class feature, now being cross-platform, being able to iterate over simple integer ranges, just to name a few.

PHP has also evolved pretty well on its own, but unfortunately the mentality and mechaniscs of old are still pervasive.

One particularly very good point is about readability and inclusivity in the core language. A word of caution about the community though, is that nowhere everything is all flowers. For example: web.archive.org/web/20090201190833...

Cheers!

Collapse
 
andyrosenberg profile image
AndyRosenberg

The core library’s built-in methods, great documentation, and the expressiveness of writing Ruby code are what I love the most. I’ve had to have the conversation with naysayers, and the Ruby ecosystem is not perfect, but the raw language holds a place in my heart.

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Exactly! See, that’s the thing: Ruby “holds a space” in my heart too. It’s just designed so thoughtfully and well.

Collapse
 
lepinekong profile image
lepinekong

Would like to learn Ruby as it seems close philosophically to rebol/red but more mainstream dev.to/lepinekong/red-for-hopeless...
but lack of time :(

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Ohhhh this is so interesting, thank you for sharing!
If you ever have a little bit of time, I’m happy to point you to resources to learn Ruby!

Collapse
 
lepinekong profile image
lepinekong

You're welcome ;)

Collapse
 
lepinekong profile image
lepinekong

I intend to go back to Cambodia because of my mother getting very old and I wanna learn Ruby-on-rails because it seems very popular in Asia ;) Hope to start learning it next year more reallistically.

Collapse
 
macnick profile image
Nick Haralampopoulos

I like Ruby for the same reasons but I have to admit: I absolutely love JavaScript.

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Plot twist: I also love JS ❤️ for different reasons than Ruby and it’s a different kind of admiration.

Collapse
 
bengreenberg profile image
Ben Greenberg

What a beautiful tribute to Ruby, and I'm so touched and honored to be included amongst such kind and generous Ruby friends!

Collapse
 
sylwiavargas profile image
Sylwia Vargas

If Ruby were a human, it would be you 💖

Collapse
 
aalphaindia profile image
Pawan Pawar

Keep sharing!!

Collapse
 
nauman profile image
Nauman Tariq

Thank you for mentioning the Rails slack community :), glad you like it!

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Thank you, Annie. I had a lot of fun writing this blog post. I appreciate you!

Collapse
 
jasoki profile image
Jason Kim

Readable syntax and helpful error messages help me a lot

Collapse
 
sylwiavargas profile image
Sylwia Vargas

These error messages are everyone’s dream, aren’t they? ❤️

Collapse
 
nickmaris profile image
nickmaris

Yes, stress-free testing

Collapse
 
appmapruby profile image
AppMap Ruby

Loving to hear Ruby characterized as "the Ruby phenomenon" it is a special thing :-)

Collapse
 
sylwiavargas profile image
Sylwia Vargas

It really is, isn't it?
I haven't gotten a chance to participate in RubyConf but I imagine all kindness and joy of the world concentrating there 😂