Live data from Hacker News

Ruby's exceptional creatures

exceptionalcreatures.com

91–100 of 133 posts

Re: Ruby's exceptional creatures

#91
post #75

It's painful to see method_missing called out as a first class solution in the first creature https://www.exceptionalcreatures.com/bestiary/NoMethodError.... . "Practical Ruby" has three chapters dedicated to method_missing. "define_method" is more common these days and also painful to see. Ruby gets a lot of criticism for embracing magic and indirection ("Ruby, the bad parts of Perl"). It has some good parts (no fun…

In every language without method_missing or equivalent, people end up writing custom dispatch based on message values sooner or later, sometimes re-implementing full method dispatch, and occasionally a full inheritance mechanism in the process. If the set of messages you need to handle dynamically is to only ever be small, define_method() is the better choice, but when it is not, I'll take careful use of method_missi…

I have no idea what you're talking about in your first paragraph. I've put code in production in half a dozen languages, and ruby is, by a immense marging, the biggest offender on this. The only thing that comes close would be AOP in Java, that is bad but at least it's compile time magic with decent IDE support.

All the most heinous bugs I've had to deal with in my life were about magic in ruby. I've worked in 3 of the biggest rails codebases in the world, and in the end we had build checks to deny code with magic.

Software code should be optmised for reading and debugging, not looking nice for first time writes.

Re: Ruby's exceptional creatures

#92
post #68

Earlier quoted context omitted.

This is more or less personal preference though. When you say that Ruby ignites a passion for coding for you then that might not happen for other people. For example I only feel a headache when I look at Ruby code. For context: I worked with C, C#, some Python and now mostly work in Go.

How often do you see people describe that kind of passion for Python? Maybe for lisps, Erlang, Haskell, Smalltalk. It may well put some people off, that's fine, but personally I dread it when I have to work with languages that don't instill that kind of passion. There are plenty of things I'd like to be different about Ruby and the tooling, but with Ruby I feel like I'm crafting something that at least has the potent…

I think Ruby is polarizing. It is the only language I have used that I feel a genuine dislike for. Other people I have talked to feel the same. Then there is a group who loves it.

Re: Ruby's exceptional creatures

#93
post #41

Earlier quoted context omitted.

Better than Python? 15 years ago I would have agreed. Today, Python is a "gateway" to programming that is also the real thing. It's like one of those old languages designed for beginners to learn coding... and then you can continue to use the same language for your entire professional career as a software engineer, to build just about any production-ready application. Ruby is a beautiful language, but unless you are…

The biggest difference between both is mainly their machine learning story but if you don't intend to go in it (this is a very specific career choice), I'd say both are equally good options. I'd say both are pretty bad at performance critical tasks or UI stuff where usually you would use neither of those.

The tools and libraries for both GIS and Civil Engineering are also much much more developed in Python compared to Ruby. As are the tools for most areas of mathematics, and probably most other scientific and engineering fields.

Re: Ruby's exceptional creatures

#94
post #75

Earlier quoted context omitted.

In every language without method_missing or equivalent, people end up writing custom dispatch based on message values sooner or later, sometimes re-implementing full method dispatch, and occasionally a full inheritance mechanism in the process. If the set of messages you need to handle dynamically is to only ever be small, define_method() is the better choice, but when it is not, I'll take careful use of method_missi…

I have no idea what you're talking about in your first paragraph. I've put code in production in half a dozen languages, and ruby is, by a immense marging, the biggest offender on this. The only thing that comes close would be AOP in Java, that is bad but at least it's compile time magic with decent IDE support. All the most heinous bugs I've had to deal with in my life were about magic in ruby. I've worked in 3 of t…

Pretty much any switch/case or multipronged if is dispatch in disguise. Sometimes the switch/case/if is the right choice, sometimes it's making the code more convoluted. Once you step up a degree in complexity, you get e.g. lookup tables and class hierarchies to emulate more dynamic dispatch. Complex dispatch is all over the place in most large systems.

Ruby is "an offender" in this to you because you hate the pattern that untangles the huge unholy mess that less dynamic languages use instead. E.g. hacky workarounds like whole class hierarchies or (marginally better) maps from values you dispatch on to first order functions/closures

I have worked in over a dozen languages, and I've never seen a medium to large sized project where some form of dispatch mechanism hasn't been part of the codebase somewhere.

And I'll take the simplicity of dynamic dispatch over hand rolling verbose mappings any day.

> All the most heinous bugs I've had to deal with in my life were about magic in ruby. I've worked in 3 of the biggest rails codebases in the world, and in the end we had build checks to deny code with magic.

I have no like for Rails, it encourages a lot of awful shit, but I also find this really curious, because the backtraces will clearly indicate you've passed through method_missing, you can breakpoint requests and attach remote debuggers to in flight requests, and execute code in-context in those requests.

If that's too complex, sure, maybe a large Rails code base isn't right for you. I don't want to work on Rails codebases either, but because of Rails, not Ruby, nor because the dynamism makes it any harder to debug.

> Software code should be optmised for reading and debugging, not looking nice for first time writes.

I agree,and it's exactly why I love Ruby.

Re: Ruby's exceptional creatures

#95
post #68

Earlier quoted context omitted.

This is more or less personal preference though. When you say that Ruby ignites a passion for coding for you then that might not happen for other people. For example I only feel a headache when I look at Ruby code. For context: I worked with C, C#, some Python and now mostly work in Go.

How often do you see people describe that kind of passion for Python? Maybe for lisps, Erlang, Haskell, Smalltalk. It may well put some people off, that's fine, but personally I dread it when I have to work with languages that don't instill that kind of passion. There are plenty of things I'd like to be different about Ruby and the tooling, but with Ruby I feel like I'm crafting something that at least has the potent…

People have different ways of expressing passion. I like Go a lot, but most of the time I'll say that it "just works" or "gets out of the way". But I have a real passion for the way Go was made for software engineering rather than programming. I wouldn't describe Go as elegant, and not as brutalist either. It kind of feels like home to me. We don't have an equivalent to that Exceptional Creatures website, which I find beautiful. But we have my favorite technical writing ever. It's always a joy to read something written by Rob Pike, Ian Lance Taylor, Alan Donovan, Russ Cox, and lots of others.

Re: Ruby's exceptional creatures

#98

I don't know what it is about Ruby that turns every HN thread that mentions it into a flame war about how it's not the perfect language. People don't do this with other languages. What gives?

I think python is the only language where the inevitable flamewar isn't about the language itself (it is instead about static vs dynamic typing). Java might be in this list too (usually the war is about OOP in general, but there's plenty of criticism levied at Java itself).

Discussions about C devolve into a religious war about simplicity and portability vs safety and an inadequate standard library.

Discussions about C++ devolve into a religious war about memory safety, bloat, developer competency, UB, and more.

Discussions about Haskell devolve into a religious war about powerful type systems and language constructs vs performance concerns, development complexity, and "endofunctors, lol."

Discussions about JS devolve into a religious war about npm, web dev in general, "== vs === lol" and more.

Discussions about Rust... oh boy.

In my experience, most discussions of specific components of languages inevitably spill into these broad and neverending religious wars.

Re: Ruby's exceptional creatures

#100
post #82
post #68

Earlier quoted context omitted.

How often do you see people describe that kind of passion for Python? Maybe for lisps, Erlang, Haskell, Smalltalk. It may well put some people off, that's fine, but personally I dread it when I have to work with languages that don't instill that kind of passion. There are plenty of things I'd like to be different about Ruby and the tooling, but with Ruby I feel like I'm crafting something that at least has the potent…

At least when I was learning Python (which admittedly is over a decade ago at this point), there was a lot of that passion for Python and what made it great - you'd get things like the Zen of Python quoted, there was the "import antigravity" XKCD comic, a lot was made of things being "pythonic" and "for humans". I think the major reason for cultural change is that there's fewer people learning programming for fun, an…

In the mid naughts ruby/rails was catching on and rubyconf was getting bigger, but the events were on the _weekends_ because most of these were people doing it for fun and not able to expense it to their employer or get time off. There was pushback from prominent people about how ruby was no longer an insurgency and needed to grow up and have employer-paid conferences, which got a nice response from _why the lucky stiff which I can no longer find.
Post reply on HN