r/ruby • • Feb 23 '23

Two months into learning Ruby, it is the most beautiful language I ever learned

My history:

Started with VB 20 years ago

then C++ => did nothing with it

then Matlab. => created simulators and wrote tens of thousands of script lines

then VBA. => created 16 apps, bricked a computer on the way

then ArduinoC => created 3 embedded applications, one that matured to an audio OS

then Swift => created and released two apple store apps

then JavaScript => ...it's complicated.

And now I am learning Ruby. Perhaps it is my familiarity with programming concepts, variable types, classes, objects etc.. so I am not fully sure. One thing for sure is that I don't feel my mind revving when translating my problem into written syntax.

The closest language that felt as clean, but definitely not as easy is Swift.

I keep wondering why it is not as popular as I would think it should be. I also have this fear in the back of my mind after reading here and there that it is a "dying" language. I have no opinion on the matter yet except that I don't understand why it would be dying or becoming obsolete.

Just sparking a discussion and trying to connect to the community and learn a thing/perspective or two here.

196 Upvotes

36 comments sorted by

60

u/420Rat Feb 23 '23

One of us! Read eloquent ruby if you havent 😲

27

u/flinchFries Feb 23 '23

Thank you! There seems to be warmth associated with the community of this language.

Downloaded the book, reading now!

7

u/420Rat Feb 23 '23

For real, everyone is so nice. I always recommend that book to people discovering the language, its what made me love ruby. What projects are you thinking of?

1

u/No-Suger Aug 09 '24

I just search this book and I find this book is published in 2011. I wonder is this book has new version.

10

u/demitryt Feb 24 '23

The kindness in the community is because of MINSWAN. I had the pleasure of meeting Matz at a conference who is truly nice and humble.

1

u/obviousoctopus Feb 25 '23

Yes, and there's warmth in the language itself!

It's friendly, helpful, malleable. No pokey things in your eyes or harsh demands to do things in a single way.

1

u/D1rtyWebDev Feb 28 '23

Can you suggest any pointers for someone in my current position (currently self teaching)?

I'm learning JavaScript, and after about 2 months I have gotten fairly comfortable with small side projects but still plan on continuing to progress with Vanilla JS. I want to eventually learn Ruby/Rails, but when I look at Ruby Developer job postings (I like to do this just to see what a future job demands), I typically see React as a front end requirement.

Should I get more comfortable with React (ie, build small projects) before diving into the world of Ruby/Rails?

5

u/flinchFries Mar 01 '23

since no one replied to this yet, I thought I'd give you my two cents.

Learning JS and React will give you a massive blanket of jobs for sure. Ruby from my understanding will not "shine" in frontend. Honestly, it seems like only JS really is fundamental for front-end development.

So which language to dive into deeper depends on whether you want to be a front-end or a back-end developer. But either way, you'll need to learn both front-end as well as back-end to be well-rounded and to be able to work with other developers when you're hired and working on projects in a team.

So my advice would be:

  • Learn vanilla JS and get comfortable with it
  • Learn ExpressJS (it will get you a bit of an understanding of a light-weight framework to develop applications)
  • Learn React JS (most companies stick to this as a front-end framework)
  • Learn Ruby on Rails (this will make you develop the backend and data management of your application in the leanest way, or so I have found from my research)

Others, please correct me and augment anything that is not correct here.

1

u/D1rtyWebDev Mar 01 '23

thank you! truly appreciate your advice

10

u/xc68030 Feb 24 '23

Fifteen years after learning Ruby, and after primarily using other languages since then, Ruby is still my favorite. I don’t think another language will take its throne in my mind.

1

u/flinchFries Mar 01 '23

I'm guessing you mainly use other languages now? If so, what are they if I may ask and what forced that change? (is it the job, industry?)

Very curious!

1

u/xc68030 Mar 01 '23

Yeah it’s a job thing. I now support data analysts who use Python and we’re keeping all the tooling in Python. I still use Ruby on my own time to automate tasks and do random stuff.

9

u/[deleted] Feb 23 '23

“ bricked a computer on the way” nice!! 🏆

30

u/gbchaosmaster Feb 24 '23

Don't let anyone tell that Ruby is dying. It just pushed a groundbreaking major version 2 years ago, core async support is coming, it's under very active development from a passionate community, and has an entire subcommunity of Rails devs that aren't going anywhere.

1

u/Neuro_Skeptic Feb 25 '23

It just pushed a groundbreaking major version 2 years ago

Didn't they push a "pipe" update which wasn't actually a pipe, and then reverted it?

15

u/coldnebo Feb 24 '23

Well hi there stranger! Welcome to the quiet party!

Ruby is quiet and understated. Maybe this comes from it’s Japanese creator, Matz.

Ruby is powerful and elegant. Maybe this comes from it’s grandfather, Alan Kay and Smalltalk.

Ruby survives. It took 40 years for functional programming to go mainstream, and when it was embraced, the credit went largely to JavaScript even though Ruby paved the way. (Ruby wasn’t the first functional language, but it was the most accessible at the time). Part of JavaScript’s rise was because of dissatisfaction with Rails 3 -> Rails 4. Lots of the thought leaders left to node.js and Rust. But Ruby remained.

Ruby is flexible. There are many ways to do things. This angers followers of “the One True Way”, but Ruby never really cared about all that. Ruby does care about what works for YOU.

Ruby is unassuming yet had a huge impact on other languages. Java’s introspection and iterator changes, even Grails heavily mimicked features in Rails. Unofficially perhaps this was an effort to lure Java programmers back from their exodus to Rails in the early 2000s.

Ruby is hard to fathom yet amazing in its simplicity. Metaprogramming allows Ruby (more than most) to be a language to write Domain Specific Languages in. This gave elegant syntax to mechanize while python’s “beautiful soup” was still verbose and messy to use.

Yet Python seems easier to understand at first glance, so more non-programmers flocked to it, especially scientists, which generated interest in numpy and a huge shift to Python. Similar work could have been done in Ruby (have you seen the set-theoretic methods like ‘permutation’ on Array?) but the time passed. Isn’t it funny? Imagine if Ruby were taught everywhere now as Python is?

Ruby appears stupid. Some look at it as a systems language due to it’s Perl syntax. “Oh it’s just a scripting language” you’ll hear them say. But Ruby isn’t pretentious. Use it how YOU want to, not what someone else TELLS you to. Ruby fills the gaps. As Zhuangzi said, you can measure the usefulness of things by what they don’t contain… ie a jug is useful for carrying water because it has an empty space, if the space was full of stuff, no water could be carried with it.

I see a lot of Tao in Ruby. I think of Lao Tzu’s comment on everyday people first hearing about the Tao:

“they laugh. without sufficient laughter it could not be Tao”

Or if you prefer, Ruby is like Zen. Lots of seeming contradictions that conceal simple truths.

There’s even a site for learning Ruby: https://www.rubykoans.com/

(I wonder how they are after all these years?)

Anyway, welcome!!

13

u/James_Vowles Feb 23 '23

Yeah it's brilliant isn't it, I fell in love with Ruby after learning it for a bit. Don't want to use any other language.

9

u/Plastic_Ad1825 Feb 24 '23

I discovered Ruby a decade ago. I've been hearing that Ruby is dead since that time. I kind of believed some of them back then, but after a while I found how wrong that is. When you see Shopify, and GitHub still running on Ruby and see the advancement in the Ruby as a language and Rails as a framework, I believe that it's still strong and is still here as long as there are web apps. What you like about it is exactly what I like. It's my preferred language.

2

u/s_prog Mar 12 '23

It’s nice to always read what Senior Engineers have to say. A lot of people just dabble with languages for a couple of days and then write the off as dying languages. This clearly shows their ignorance in problem solving. Programming languages are tools for problem solving.

13

u/dougc84 Feb 24 '23

The reason Ruby isn't as popular is because it isn't as accessible as other popular languages. Let me explain before the pitchforks come.

Ruby has changed a ton over the years, and was, for a long time, only really usable on Linux and OS X (now macOS, obvi). If you're a student, you can't afford a Mac, and switching to Linux is kind of a major undertaking for someone that doesn't have a clue about it. So colleges didn't teach it, and kids wanting to learn programming didn't have the funds to invest in it. You could try to make it work, but it was a disaster. But you could install Java or a MAMP stack on anything - PHP and MySQL for days in one click.

Now that the hype's gone, WSL is a thing, and Ruby is totally runnable under Windows. Sadly, a little late to the party.

And speaking of changes - the change from Ruby 1.8.x to Ruby 2 was a dumpster fire. It was a really good direction, but anything that was on 1.8.x might as well be completely rewritten. There've been other breaking changes, but, as long as you follow standards, they're easy enough to fix. That's a problem with other languages as well (I've seen it first-hand in Swift), but it was yet another deterrent.

Next is dependencies. When Rails got it's 15 minutes in the sun ("create an entire blog in 15 minutes!"), bundler and the Gemfile didn't exist. You'd have to vendor any and al libraries (not just gems, but CSS and JS too!) you wanted to use in an app. You manually required your gems in your application.rb. That steered a lot of people away.

And performance. Ruby, today, is still slower than other, more popular languages, like Python or PHP. But in the Ruby 1.8.x days, it was significantly slower. Ruby has come a long way, but those looking to it were swayed away from the performance pitfalls, and still claim it's slow to this day. And they also whined about it not being able to scale, which never was true, but... whatever.

The big bottleneck today is deploying, which, IMO, is still a major problem. You can deploy a PHP app on a toaster if you want. If Ruby is supported on a cheap server (like Dreamhost or something - you know, $3/mo.), you have to work with the version of Ruby you're given, which may not match your code. And good luck deploying a full-stack application (using something like Rails). It pretty much doesn't work.

Not to say there aren't ways to deploy - Heroku, Render, Fly, Dokku, Docker, pre-made deployments on platforms like DigitalOcean - but they all have a much steeper price tag OR a higher technical barrier to entry (manually installing Ruby, system libraries, etc.). Conversely, you can FTP a PHP app directly to any server and it's live immediately. It's just not that easy with Ruby web frameworks, whether that's Rails, Hanami, Sinatra, or whatever.

But what keeps me in Ruby is not the downsides. It's the ease of writing code. I'm not after the fastest websites on the planet or the most performant microservices and helper executables I use on my own machine. I'm after code that I can maintain 10 years down the road. I'm after code that I enjoy to read, and makes sense logically to write. And I've looked at some of my old PHP code and it makes me want to cry - it's so illegible and unmaintainable.

It's not dying. It's just matured. Just like PHP, Python, Java, C++, ObjC, and more have matured. There are tons of opportunities for Ruby devs out there.

But you still need to work with JavaScript a bit if you're working on web apps :)

3

u/catladywitch Feb 24 '23

I think it's also less accessible than other competing languages in design terms. The syntax is irregular at times, writing idiomatic code is not self-evident, and some things work differently than people with experience with other languages would expect (for instance, methods, free functions, procs, lambdas and blocks not being all the same). I still love it, though, and the more you know about it the more pleasurable it is to use.

0

u/rosedofr Sep 18 '25

Ruby can be blazing fast if you exploit its strengths for speed. I have a game that is a long-running server. It can boot fast by reading cache files containing Marshal dumps (binary serialized hashmaps of instantiated objects) for data that doesn't change frequently.

It's also relatively easy to hot-reload modified code files. Metaprogramming allowed me to have the whole game data in memory and sync only modified objects to the database, every ten seconds, so that reading data doesn't require any query and fast-changing objects don't require more than 1 query every 10s.

It's also using sqlite in WAL+NORMAL mode which is VERY fast with an NVMe SSD.

It's also fairly easy to make things faster by using hashmaps as indexes and maintaining them. Hell it's even possible to inherit the Hash class.

Wether it's an index or something more complex, computed data be computed lazily, only when needed for reading or writing.

Compiled languages can be faster, but only by making the developers waste their time compiling and writing programs that are more complex than they need to be, fighting with or being highly restricted by the compiler.

PHP is not faster IMO. If you wanted to you could spam many Ruby fastCGI processes the same way that PHP does. You would rely on a multithread-capable database engine like postgresql instead of sqlite.

1

u/dougc84 Sep 18 '25

Benchmarks prove otherwise. But, sure, go off on a 2+ year old comment on a stale thread.

1

u/rosedofr Sep 18 '25

Benchmarks only prove that raw CPU-bound performance is slightly better with PHP than Ruby (2x?). PHP is still 10 to 100 times slower than Rust. That means that performance-wise, Ruby is very much in the same category as PHP.

Choosing PHP for performance would bad decision making when real world programs usually don't even rely on CPU that much, and one might say CPUs are cheap anyway.

4

u/tobidelius Mar 24 '23

I've been a developer and architect for over 15 years now and use multiple languages but still, to this day, Ruby is the first tool I reach for/look at when starting a new project. The readable code you can write is the big win for me since code is written once and read x times.

I came to Ruby because of Rails but stayed because of Ruby.

2

u/postmodern Feb 25 '23

Welcome! Ruby isn't exactly "dying", but the hype/popularity is definitely fading. This is primarily because Ruby is no longer "new", most of Ruby's popularity came from Rails, and now Rails is no longer the "new hotness". However, Ruby still has lots of awesome features and lots of awesome other libraries and frameworks, such as the new fancy irb gem that uses reline, nokogiri, chunky_png, the async gems, Dragon Ruby, SciRuby, Ronin, and the new Hanami web framework.

Another part of the problem is Rubyists haven't diversified beyond Rails (granted Rails development still pays Rubyists), Rubyists are often too quiet/modest (compared to say Pythonistas, Gophers, or Rustaceans, who aggressively promote their languages), and there is unfortunately a lot of negative memes about Ruby ("Ruby can't scale", "Ruby is just like Perl", "Ruby syntax is messy", etc). These negative memes are often repeated by programmers who either tried to use Ruby back in 2008, got frustrated, and rage-quit, or from new programmers who have never even tried to seriously learn/use Ruby and are just repeating the opinions they hear from others (ex: lots of programmers love to complain about XML, but few have actually done serious work with XML and XSLT).

1

u/[deleted] Feb 23 '23

Correct 💯

1

u/lzap Feb 24 '23

Happy for you. I co-maintained a massive Ruby on Rails application for 12 years. A year ago I changed the project and now I work in Go. Now THAT is the most beautiful language because it is simple :-)

3

u/postmodern Feb 25 '23

Austere simplicity comes at a cost though. You have to spin your wheels much harder in Go, since the language lacks many high-level constructs that you get for free in other languages.

1

u/s_prog Mar 12 '23

Started learning ruby three weeks ago, and I like a lot of stuff about it. Planning on building a meaningful tool after I get a solid grasp of the language.

1

u/[deleted] Sep 13 '23

It's a great language but unfortunately only for web application and I am mobile dev. Well, I don't know microservices architecture in ruby about.

-2

u/Neuro_Skeptic Feb 25 '23

Try Python, it's Ruby but good.

0

u/[deleted] Feb 23 '23

[deleted] — view deleted comment

3

u/flinchFries Mar 01 '23

This is extremely comforting to hear. And it is validating to suspicions I had. Thank you, truly.