Comment by Hnus

Comment by Hnus a day ago

24 replies

Serious question: do people actually enjoy writing Ruby? I feel I’m writing in something like Bash. I never felt this way until I picked up other languages like Rust, Zig, C#, and learned a tiny bit of programming language theory. After that, the loose and squishy feel of Ruby really started to bug me. Also, it seems like every Ruby programmer I know only ever uses other dynamic languages like Python. It’s never like they’re experts in C++ or something and then decided to start programming in Ruby.

mrinterweb 21 hours ago

I had a good background in C++ programming before switching to ruby. At first, I was terrified of the lack of strict typing, but after using it for a while, I realized my concern wasn't that warranted. For me it is about the tradeoff of dealing with types vs productivity. Sure I occasionally get bit by a random "method not defined for nil" error, but it is usually very easy to fix, and I don't run into the issue very often. With ruby, and especially rails, it is about the productivity gains. I can simply accomplish much more in less time and fewer lines of code than I would in other languages/frameworks. Not only am I writing fewer lines of code (usually), the language is very expressive without being overly cryptic. The code is more readable, and to me that results in better maintainability. The strong community and ecosystem emphasis that is put on testing, also leads to more resilient and much more maintainable code.

the_fury 18 hours ago

Absolutely. I enjoy it so much that I wonder "do people actually NOT enjoy writing Ruby?" It's usually the first tool I pull out of the toolbox for DSLs, scripts, spikes, one-offs and the like. A lot of the time, the project will happily stay in Ruby unless there's a good reason to use something else. And then I move it - horses for courses.

I programmed professionally in C, C++, C#, Deplhi, and a few other languages well before I had even heard of Ruby.

vidarh 19 hours ago

Yes, love it. Rewritten large parts of my stack in it (editor, shell, font renderer, terminal, window manager, file manager)

I started from a background of heavy C++ use, including a lot of template metaprogramming. Convincing me to even give Ruby a chance took a lot, but once I'd tried it I abandoned C++ pretty much immediately, and don't miss it.

PapaPalpatine a day ago

What an odd question lol. Yes, people like writing in Ruby. I’m one of the. Switched from C# in 2016.

  • Hnus a day ago

    You don't miss things like enums, exhaustive switch or any other basic language features? How about `method_missing` its such a crazy idea to me that something like this exists, I know why it exists but I am like why, why such bloat and complexity.

    • RangerScience 14 hours ago

      Ruby inheritance is a list of class names. When you call a function on an object, Ruby goes up that list, looking for the first one that defines that function.

      If it doesn't find any class defining that function, it calls `method_missing` (and again, goes up the list). The Ruby base object class defines `method_missing`, so if no-other classes in the ineritance list do, you get that one (which then throws the usual error).

      IMO, there is zero bloat or complexity added by this; it's super simple language bootstrapping (allowing more of Ruby to be written in Ruby, vs the c interpreter).

      What do you see as the bloat and complexity added by this?

    • PapaPalpatine a day ago

      No, I honestly don’t. I can emulate an Enum without having an Enum type. I rely less on a compiler and more on myself with automated tests.

      • andrekandre 15 hours ago

          >  rely less on a compiler and more on myself with automated tests
        
        jme, but i think this is a muscle that a lot of people don't have developed if they came from a language/toolset/ide that does automatic type checking and autocomplete reliably etc
    • rubyfan a day ago

      Can you elaborate on why you think method_missing is bloat?

      • Hnus a day ago

        As another commenter said,

        > it’s about your taste and philosophy.

        Personally, method_missing goes against both of mine. It makes programs harder to reason about, more difficult to debug, and nearly impossible to `grep`. That said, I understand that this kind of flexibility is what some people like. I just don’t.

helloguillecl a day ago

I love Rails, its been my to-go framework for reference. But I could never get as confortable with Ruby as writing JS or PHP. I do not know the reason.

  • quest88 a day ago

    I agree. I think..there's too much freedom. Too many ways to do things, and debugging is hard with monkey patching.

    • vidarh 19 hours ago

      If debugging is hard to you in Ruby because of monkey patching, it's an issue of not knowing the debugging tools. Attach pry or Ruby debug, and show the source location of a method, or log them. This isn't surprising - debugging Ruby is different to debugging most static languages, and more tutorials on how to do this well would be nice...

      Also the use of monkey patching in Ruby peaked something like a decade and half ago. Outside of Rails, it's generally frowned on and introducing new methods is usually addressed by opting in by including modules these days.

      • ukprogrammer 17 hours ago

        Agreed, it still absolutely astounds me the number of developers out there that do not use a debugger as an essential part of their toolkit.

    • AstroBen a day ago

      Can you give an example of where monkey patching made debugging hard? I have a decade of Ruby experience and can't think of a single time it was an issue

      This is one of those things that sounds like it'd be a problem but it really isn't

the_lonely_time a day ago

I spent more of my life that I would like to admit learning and writing Rust. I still build all of my web applications in almost pure Ruby these days. Speed of thought to action is simply unparalleled and it turns out in most situations that was the most important factor.

maximegarcia 21 hours ago

I do. It's a whole thing that get you down to writing your business logic in an expressive way very easily. Framework (Rails) helps, yes, but even pure Ruby can be nice. I've written a second time accuracy simulator for cars and chargers in a EV charging stations in pure Ruby, that was fast to iterate around and pleasant to write.

The ecosystem, toolchain and all do a lot. It is really missed when I do other languages, and I wish to find the same way of developing elsewhere. I currently do C for embedded in an horrible IDE, and I want to bang my head against the table each time I had to click on something on the interface.

(btw Python is a nightmare for me)

tuyenhx a day ago

Yes. I do. I enjoy ruby so much.

After 10 years working with Java. Now I dont wanna go back anymore.

It is about your taste and philosophy. I dont think it related skill issue.

zem 19 hours ago

yes, I have used a lot of languages, both static and dynamic, and ruby is one of the ones I love. maintaining large code bases is certainly not its forte, but in terms of expressing what you want in code it is like a tool that fits really well into my hand.

hotpocket777 a day ago

> Also, it seems like every Ruby programmer I know only ever uses other dynamic languages like Python. It’s never like they’re experts in C++ or something and then decided to start programming in Ruby.

Can you expand on what you’re saying here or why you’re raising this is as an issue with ruby the language or rails the library?

  • monooso 15 hours ago

    There are several people earlier in this very thread who moved from C++ to Ruby.

  • Hnus a day ago

    Just a personal observation that made my communication with ruby developers hard as I cannot use concepts from strongly typed languages because they live in a word without them, but I guess it's more issue with me than them.

rubyfan a day ago

Yes, many people love programming in Ruby. It’s a matter of preference not some lack of technical merit. There are plenty of people who are well equipped in strongly typed languages that write in both. You might not know them but you really don’t have to look very far.

timewizard 21 hours ago

That's not a serious question. Of course people do. Your inability to understand the language does not impact anyone else other than yourself. This should go without saying.

I'm also an expert in C, Go and JavaScript. Ruby is an excellent language and the smalltalk paradigm has some real strengths especially for duck typed systems. The only reason I don't use it more often is because it is slow for the type of work I'm doing recently.

It was amazing for web work and it's fantastic for writing small little utility scripts.

A open distaste for things does not make you sophisticated or smart. You're not in any category of high repute when you do this.