loading...

Why I still love Ruby

Nathan Hopkins 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... [Read Full]
markdown guide
 

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.

 

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.

 

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.
 

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.

 

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.

 

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

 

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.
 

Thanks, What about performance ? does the performance is well when compared to C#, Java, Python and Go ? I also like to know which server side language is better for making web apps.

I don't know what the comparison is in 2020, but for most business logic and webapp use cases Ruby and Rails is more than fast enough. Usually the biggest speed problem in web apps results from excessive database calls and that is going to be a problem in every language.

I found a nice benchmark a while ago, comparing:
Ruby 2.7 vs. Python 3.8 => in most benchmarks, Ruby is faster
Ruby 2.7 vs. PHP 7.4 => in most benchmarks, PHP is faster

source: benchmarksgame-team.pages.debian.n...

I guess almost all compiled languages will have an edge over scripting languages.

blog.iron.io/how-we-went-from-30-s...

I don't think performance is as good as other languages, I consider ruby and python to be slow, developers write code faster though

 

functions are both first class concepts in Ruby

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

From the Ruby doc: "Proc objects are blocks of code that have been bound to a set of local variables. Once bound, the code may be called in different contexts and still access those variables."

I can also recommend a book patshaughnessy.net/ruby-under-a-mi... that goes greatly to the implementation as well.

 

There are people that will argue both sides of whether or not Ruby is more readable or maintainable than other languages. I think Ruby and Rails are both best suited for disciplined, sometimes smaller, teams. I think this actually enhances the "designed for happiness" aspect of the language. Here are some of the reasons I find Ruby so enjoyable.

  1. Brevity - syntax is very developer friendly, you can do a lot with a little
  2. Speed - unparalleled developer productivity
  3. Power - it's a very sharp tool that provides power when you need it
  4. Community - top notch people always willing to help and contribute
 

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 :)

 

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

 

"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.

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

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.

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

 

There should be one-- and preferably only one --obvious way to do it

Except for the Python dependency management ;)

 

This is an interesting question. The two distinct philosophies is certainly the primary difference between these amazing languages IMO.

 

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.

 

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

 

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

 

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

 

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

 

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

 

With smartphone screens getting bigger and HD content now widely prevalent, it's become easier than ever to turn your Android phone or tablet into a portable theater. It gets even better because Android's open architecture and app marketplace allow users to easily replace stock video players with a variety of excellent video apps, allowing you to get just the features you need. Ranging from light, easy-to-use players to highly configurable powerhouses, check out the best Android video player apps on the market today. Best Android Video Players - 2020

 

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 :)

 

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

 

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.

 

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.

 

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

code of conduct - report abuse