DEV Community

Cover image for Why I still love Ruby

Why I still love Ruby

Hopsoft on January 13, 2020

Language and Cognition Philosophers and linguists have long asked the question, Does the language we speak shape the way we think? We n...
Collapse
 
ben profile image
Ben Halpern

Ruby has a long history of assimilating the best ideas, patterns, and practices from other programming languages.

I think this is also happening in reverse a lot these days. I definitely think I spot Rubyisms in new ideas these days. Hard to trace idea origins though.

I, too, am still very much enjoying developing in Ruby.

Collapse
 
hopsoft profile image
Hopsoft

I agree that programming languages borrow good ideas from each other all the time, but Ruby's focus on developer happiness seems to make this a first class goal of the language.

Collapse
 
jrtibbetts profile image
Jason R Tibbetts

Totally agreed. I can't think of a single other language that has developer happiness as one of its stated goals. Although I don't have many opportunities to use Ruby these days, I still think that I was at my most productive when I did. Ruby (and Rails) taught me, among other things, that

  • test-driven development was actually doable and useful;
  • web frameworks didn't have be stinking pieces of shit; and
  • "convention over configuration," far from being limiting, frees you up to do what's really important in your apps.
Collapse
 
shaijut profile image
Shaiju T

πŸ˜„, I used to have questions like which language is better ? After discussing with my friends and listening to people online, I realized that Its better to stop asking these questions. Instead start asking which tool is better for current Job and Trend.

Choose the right tool for the Job.

  • Based on your experience, you can use C# or Java for building enterprise and large applications.
  • Instead JSF you can think of using Anuglar orReactorVueetc. for Front End.
  • Python for Machine Learning.
  • Go for Micro Services based performant applications.

In future maybe today's Languages and Framework may be outdated, so to survive you will be forced to learn new language of that time.

Conclusion:

  • Developer Happiness, stick to the language which make your life easier, like easy to read syntax, maintainable, has Good IDE. I like C# for current work, and its up-to you to decide what you like.

  • Its always good to be Open to learn any language as required and Choose the right tool for the Job.

Hope this helps.

Collapse
 
notjames profile image
Jim Conner

Yup. Like Rust! Obviously Crystal, which is a statically typed Ruby mock-up I believe.

Collapse
 
andrewmcodes profile image
Andrew Mason

I should point out that Rails wouldn't exist without Ruby.

I think this is a key takeaway. I always hear people talking about how they are trying to create Rails for their given language, like JavaScript, but no one has quite hit the mark. It's called Ruby on Rails for a reason!

Like Ben, I am also still really enjoying developing in Ruby.

Collapse
 
leob profile image
leob

Laravel comes pretty close doesn't it? Although it seems that Laravel adopted a bit more of the "architecture" and "patterns" mindset of Java, and it's a bit more verbose (I admit you could say more clunky) than Ruby/Rails. But, when working with Laravel the feeling I get is pretty close to the feel of working with Rails.

Collapse
 
shaijut profile image
Shaiju T • Edited

Is Ruby more readable and maintainable than C# and Java, What are its advantages compared to C# and Java ?

Collapse
 
kwstannard profile image
KW Stannard

Ignoring frameworks and libraries I would say this:

  • Ruby is much lighter on syntax than Java and C# so it can be incredibly easy to read.
  • Ruby is a dynamic scripting language so it is very easy to make changes to anything about your app and see what happens. I make a lot of OSS contributions by just altering a few lines of code in a third party library and seeing if it works.
  • Objects and functions are both first class concepts in Ruby so you can do both object oriented and functional programming at the same time.
  • Ruby is a scripting language, so you can use it for everything from a terminal one liner to a business application to microservices.
Collapse
 
notjames profile image
Jim Conner

One thing I'd like to add for those who are put off by dynamically typed languages (scripting languages, usually). There's a project called crystal, which is a statically typed Ruby-based compilable language. So if you wanna learn Ruby but use it in a compiled language, consider crystal. It's still in pretty heavy development, it seems, but I've done some small projects with it. It's a little different, but I like it because of its Ruby syntax. I love Ruby.

Collapse
 
strzibny profile image
Josef Strzibny • Edited

functions are both first class concepts in Ruby

Actually Ruby does not have functions at all. There are all methods.

Thread Thread
 
swiknaba profile image
Lud

They are all objects! :D

Thread Thread
 
kwstannard profile image
KW Stannard

Procs are functions.

Collapse
 
juancarlospaco profile image
Juan Carlos • Edited

If you love Ruby in 2020, go join Crystal lang community, Ruby and Crystal should tinker with more cross-project collaborations.

Collapse
 
jonathans profile image
Jonathan Sundqvist

Compared to the mantra of python. "There should be one-- and preferably only one --obvious way to do it". I wonder if that has constrained python developers :)

Collapse
 
benbot profile image
Benjamin Botwin

Matz (the creator of ruby) used to talk about the "Principle of least surprise" being this idea that if the way some language feature works doesn't surprise you, then you're happier for it.

Because of this idea Ruby has many MANY different obvious ways to do anything. This makes many different kinds of devs happy, because they can always write in the way that makes the most sense to them.

This is an amazing boon as a solo dev or a small team, but in larger settings this can be kind of a pain since a code base could become inconsistent pretty quickly unless the org enforces a kind of style.

Python takes the opposite approach.

That's probably why in the early 2010s there was a lot of (mostly comedic) volatility between the ruby and python communities

Collapse
 
jonathans profile image
Jonathan Sundqvist

"Principle of least surprise" maps pretty well onto there should ideally only be one way to do something. If there isn't several ways of doing something it's not surprising :).

I was reading some ruby a while ago, and stumbled upon. array << element. It took some serious googling to figure that one out, and I'm sure there are several ways you can write that too.

Thread Thread
 
benbot profile image
Benjamin Botwin

I think the approach that ruby took is one of individuality. Imaging that the "one preferred way" of adding elements to arrays was array << element.

You'd be surprised that something like array.push wasn't working, and even more surprised that array << element even existed.

Even though, in our hypothetical language, that's the only preferred way to push to arrays, it's still surprising.

If any of that made sense

Thread Thread
 
hopsoft profile image
Hopsoft

It's fascinating to see how something like "principle of least surprise" can be interpreted and addressed so differently. The Ruby and Python solutions for this could not be more different.

Thread Thread
 
benbot profile image
Benjamin Botwin

It’s especially interesting because both languages (python 2.7 at least) are pretty similar from a high level technical point of view.

Both OOP style languages
Both interpreted (usually)
Both very high level
Both dynamic
Both are even heavily used in web development

Collapse
 
philnash profile image
Phil Nash

I still find it easiest to think in Ruby. Maybe that's because I have been writing it for so long, maybe it's because the standard lib handles many details I don't need to think about, and maybe it's just because it truly does live up to Matz's mantra of developer happiness.

All I know is that I still love writing Ruby too.

Collapse
 
fyodorio profile image
Fyodor

The way people talk about Ruby makes me want to learn this language so much

Collapse
 
tfantina profile image
Travis Fantina

It's a pretty approachable, tons of resources I'd highly recommend you give it a go.

Collapse
 
lynx_eyes profile image
Ivo Jesus

I agree on some stuff, disagree on others.

Most points you make about ruby resonate with me, I love the expressivity, the malleability - gives me options.
In theory it does allow me to explore a lot an solve problems in many different ways.

But does "ruby culture" really exist? Or all we have is "rails culture"?

Rails probably represents 95%+ of all ruby projects out there, with them often you get that aggressive rails culture of "the right way to do things is X" and suddenly fantastic language features are thrown out the window...

I'd like to be as optimistic as you are, I really do, but I'm almost out of faith here..

Collapse
 
hopsoft profile image
Hopsoft

Agree that Rails monoculture isn't always great and can be dogmatic at times; however, the non-Rails (or Rails adjacent) ecosystem seems pretty vibrant to me right now. Hanami, Roda, Phlex, etc... lots of activity and cool stuff going on out there.

Collapse
 
etampro profile image
Edward Tam

Benefits of Ruby's development happiness can be translated into it one key business metric: Development lead time. That is a important metric for businesses to stay a step ahead of the competitors especially for startups. I think that is why a lot of the new companies are still on RoR, even though people keep shxtting on it :)

Collapse
 
marcbeaujean profile image
Marc Philippe Beaujean

Although I never coded in Ruby (Python dev) it would still be my second choice - I love Django and in many ways, Django is great because of RoR

Collapse
 
andrewmcodes profile image
Andrew Mason

I’ve heard Taylor Otwell say he pulled a lot of inspiration from for Laravel from Rails as well.

Collapse
 
andrewbrown profile image
Andrew Brown πŸ‡¨πŸ‡¦

I still love Ruby and use it every day.
I never thought Python would bound back as it did.

Collapse
 
veer66 profile image
Vee Satayamas

I have used Ruby instead of Perl and Awk for 18 years already. 😍

Collapse
 
notjames profile image
Jim Conner

I love Ruby...but I love Perl too!

Collapse
 
darkrubyist profile image
darkrubyist • Edited

I enjoy developing in rails and I wish I had the time to learn more.
After 3-4 years of coding in Ruby, I'm still learning new things.

Collapse
 
hopsoft profile image
Hopsoft

I'm still learning new things after 10+ years with Ruby and Rails. The breadth of features has much to do with this I think. It may not be at the top of the hype cycle, but there are new and interesting things constantly happening in and around both Ruby and Rails.