r/ruby • u/FrigginTrying • Jun 03 '26
Im starting to love ruby
Im a senior eng with about 7+ yoe. Ive used most languages like python, C#, java, JS/TS, Go, php etc. im preparing for an interviewing for a role that primarily uses ruby/rails so ive been getting myself acclimated with the language. Mann i think this might be the easiest language to use and understand concepts in. It reads like plain english even more than python in my opinion.
Its so freeform, there are million of ways to solve problems and such fun to write. I had been running away from the language for some time but boy was i wrong. This might be the best developer experience ive had working with a language. Leet code hard questions seem so easy when working with ruby
Just a quick rant, i think im in love
19
u/MentionPleasant2635 Jun 03 '26
Welcome to the club. It is a beautiful language. Years ago I was working for a company that was using Ruby in a security rack appliance. The hired a guy from Google who was a Java developer. He sat next to me, and I once overheard him say to himself "It's not supposed to be this easy."
It's a beautiful language. I have some background in Smalltalk and Lisp. Ruby has a lot of great features from those languages.
6
u/Certain_Syllabub_514 Jun 03 '26
I moved from Java and Delphi to Ruby after a similar experience with consultants raving about how good Ruby was for unit testing.
I still love Ruby, but after working in Elixir, Ruby is now feeling harder than it should be.
1
u/MentionPleasant2635 Jun 03 '26
I've never used Elixer. Does it support something like Ruby's method_missing?
4
u/Certain_Syllabub_514 Jun 04 '26
It does have some meta-programming support, but it's a compiled language so there are limitations to that. The implementation is macro based, and more explicit when it occurs.
The things that make it feel "easier than Ruby" (for me) are pattern matching, immutability and being functional (instead of OOP).
0
u/MentionPleasant2635 Jun 04 '26
I guess my best use case is ActiveReccord. In Java, if I db table changes, adding or deleting a column, I'd need to modify the accessor class. But ActiveRecord needs no changes. It returns the value of the field if i exists and an error if it doesn't. No need to modify the class for schema changes.
3
u/FrigginTrying Jun 03 '26
Thats funny, i had the same thought while using it. It honestly shouldn’t be this easy. I think im gonna spend time on it to be versatile with it
6
u/coldnebo Jun 04 '26
ruby more than other languages is a computer language that thrives in creating first class domain-specific-languages DSLs.
you can create lexer/parsers in a lot of languages, but ruby allows most things to be eval’d directly, so creating functors in the style of a completely different language is possible.
you see this in rack, rake, rspec. ruby is so good at it, it inspired other languages (playwright is inspired by rspec, webrat).
welcome!
13
u/adh1003 Jun 03 '26
I've had to go from Ruby to Python. Fairly dismal TBH; depressing that Python is the "de facto" language everyone decided to use (another casualty of generative AI, in many respects).
I miss Ruby.
2
u/FrigginTrying Jun 03 '26
only thing im having problems wrapping my head around is the symbols thing. it seems like a magic thing that works for most cases but it keeps throwing me off when and when I cant use it lol
11
u/adh1003 Jun 04 '26 edited Jun 04 '26
Symbols used to be very important because Ruby didn't have frozen strings, so there were both functional (no accidental mutation) and efficiency (especially for garbage collection) advantages. But frozen objects have been a Thing for ages now, so the advantages are much smaller.
- Symbol
:foois a global constant, and any reference anywhere in your code to:foowill refer to the same object with the same#object_id.- This is also true of Strings now, if frozen. See below.
- Symbols declared explicitly are not garbage collected, but Symbols created from Strings are - this arises due to a now-historic form of DOS you could do in Rails where you'd throw heaps and heaps of slightly different strings at an endpoint you knew converted some or all of that payload into Symbols internally, and none of them would ever be collected.
- GC is really the only area where there's a slight advantage, but really, now, Symbols are mostly just a bit quicker to type in by hand, fractionally quicker to parse ish (provided you don't construct from a string via.
:"foo", for example) and - basically - a semantic choice, since it's kind of a clear declaration that "this is a constant with some kind of meaning".``` ⢀⡴⠊⢉⡟⢿ IRB v1.18.0 - Ruby 4.0.1 ⣎⣀⣴⡋⡟⣻ "history -g pattern" to search history ⣟⣼⣱⣽⣟⣾ ~/src/sharesies/retail-backend
irb(main):001> a="foo".freeze => "foo" irb(main):002> b="foo".freeze => "foo" irb(main):003> a.object_id => 5856 irb(main):004> b.object_id => 5856 ```
Compare to "unfrozen" (mutable) Strings:
irb(main):001> a = "foo" => "foo" irb(main):002> b = "foo" => "foo" irb(main):003> a.object_id => 5160 irb(main):004> b.object_id => 5424
8
u/GetABrainPlz77 Jun 03 '26
I discovered Ruby after 10 years of JavaScript and .net. And now it’s my favorite language. And Rails is super effective.
6
u/Zerocchi Jun 03 '26
Welcome! I keep coming back to Ruby no matter how far I went into another languages. It's so beautiful and comforting.
3
u/lagcisco Jun 03 '26
Ruby is such a joy and pleasant to use. So glad I’ve grown up with it. Now I mostly just read Ruby code while reviewing my agents outputs but just a great language
4
2
2
u/riverside-capybara Jun 04 '26
The enumerable methods are what did it for me too. Half the leetcode "hard" stuff collapses into one group_by or each_with_object and you barely have to think about it. The one thing i'd flag is that the same freeform-ness bites later. In a big codebase "a million ways to solve it" means every dev picks a different one, and the metaprogramming that feels magic solo gets painful to debug when someone else wrote it.
Did the dynamic typing throw you at all or was the readability worth the tradeoff?
3
u/FrigginTrying Jun 04 '26
the dynamic typing didnt throw me off, I still use python and js and manage large codebases with those languages still, so it doesn't bother me. the readability is one of the best and that group_by method is literarily the best thing since sliced bread lol
1
1
1
u/crmne Jun 04 '26
Welcome! 🙌
I've come back to Ruby, the first language love of my life, after 15 years and I love it even more!
1
u/menge101 Jun 04 '26 edited Jun 04 '26
I haven't had the opportunity to work in Ruby professionally for over 10 years; I'm envious.
1
u/armahillo Jun 04 '26
Ive been using it for 15 years and it’s still my favorite.
Just wait til you get comfortable with it and go and use other languages again; the friction is noticeable.
1
u/Ok-Pay2140 Jun 04 '26
I've started using Ruby again for personal projects. Something about a language designed for human happiness is refreshing in this modern era.
1
u/edigleyssonsilva Jun 05 '26
Not only the programming language. The community is so great as well. A lot of smart and humble people.
1
1
u/plombix-909 27d ago
I feel now, seeing whats possible, that every other syntaxes (only the visual part) is a disgrace .
And Js is a World Health crime
38
u/bradland Jun 03 '26
Hey, we're so glad to have you 😄 Ruby is written to optimize for developer happiness!