Settings

Theme

Understanding the Ruby object model

skilldrick.co.uk

43 points by skilldrick 14 years ago · 20 comments

Reader

sleight42 14 years ago

I'm sorry to be critical but this article is a dangerously incomplete treatment.

For instance, methods only exist on classes. And there's no mention of the singleton class whatsoever.

For a more accurate lesson, watch Dave Thomas, author of the "Pickaxe" Programming Ruby book, present on the Ruby Object Model: http://scotland-on-rails.s3.amazonaws.com/2A04_DaveThomas-SO...

  • skilldrickOP 14 years ago

    > Note that this is a basic explanation, and glosses over higher-level concepts like the eigenclass/metaclass (I’ll leave that for a later post).

    • blaix 14 years ago

      Glossing over those things misses the entire point. Not worth posting without it. The videos mentioned in the parent comment get it so right. Highly recommended.

sotu 14 years ago

I've just started with Ruby and Rails using a book called Ruby on Rails tutorial 3.. this article didn't provide anything that I found useful. It reminded me of a lecture on Java I heard about in Computer Science 101 day 2.

  • jcoder 14 years ago

    Utility is relative to curiosity. A butcher might be interested in animal husbandry, but maybe they just want to cut steak. To a Rails dev, this is all "what happens to the cow before it's steak" stuff.

  • skilldrickOP 14 years ago

    I'd recommend coming back and reading it when you've learned a bit more Ruby then. If you've "just started" then you probably don't yet have the experience in Ruby to understand what it means.

    I understand that at a first glance this looks like basic stuff that doesn't explain anything useful, but with a bit more experience you'll see that it's fundamental to understanding how Ruby will react in certain situations.

asdfaoeu 14 years ago

Sounds like a database admin learning ruby. No idea why anyone wants to think of classes as anything more than fancy structs with allocation.

  • rohitarondekar 14 years ago

    It's this kind of thinking that leads to "Ruby is all magic!". You have to understand the object model to get maximum benefit from Ruby. To be fair you need to understand the object model of any OO language to get a deeper understanding of the language.

  • skilldrickOP 14 years ago

    It's essential to know this stuff to really understand how Ruby works. If you want to know which method is going to get called then you need to grok the object model. Classes in Ruby are much more than "fancy structs with allocation", and thinking of them in that way means you'll be losing out on a lot of Ruby's power.

  • grimen 14 years ago

    Yet Ruby object model don't work the same way as you would suspect - at least in compare to many other languages. You might get surprised. To see what I mean: http://scotland-on-rails.s3.amazonaws.com/2A04_DaveThomas-SO...

atomicdog 14 years ago

Is Ruby still considered a "fad" or is it actually gaining weight as a serious development platform? I'm seeing more and more articles about it on HN these days.

  • dasil003 14 years ago

    Do mean by comfortable and overpaid institutional devs who are deathly afraid of losing their cushy position and thus measure the quality of any programming language by library availability for their bloated corporate standards checklist?

    I'm not sure because I don't really talk to those folks.

    As far as bleeding edge web development is concerned, Ruby has been a serious tool for the past 7 years, not sure where you've been.

  • 3pt14159 14 years ago

    It is a serious development platform. I know several high volume hedge funds that use Ruby because their Quants want to be able to stub out new ideas FAST. If the strategies end up being successful, then they get ported down to C or Java, but their are Trillions of dollars moving through Ruby code every day.

  • atomicdog 14 years ago

    I guess the fact that people have just downvoted rather than explaining confirms it's still a fad.

    • skilldrickOP 14 years ago

      It's a bit like saying "I see a lot of women have jobs these days - does that mean that feminism is more than just a fad?" You're not going to get any helpful responses if you ask something inflammatory (and I think it shows maturity that no-one's flamed you).

      Anyway, what would you gain from asking a bunch of Ruby developers whether Ruby is "just a fad"? This is hardly the best venue for that question.

      Incidentally, I didn't downvote you, just thought I'd try to explain why nobody responded to you.

    • evilduck 14 years ago

      I downvoted you because you weren't asking an honest question and that adds nothing to the thread.

      Posting an inflammatory response in tandem with a question already loaded with rhetoric ("fad", "serious tool") isn't going to spur interesting or valuable debate because you've shown you're already cemented into your position before you even started.

    • to3m 14 years ago

      Erm... I believe it's pretty popular in web-land, has been for some time, and remains so.

      Though I have no personal evidence for any of that ;) - I have never used Ruby, I don't know anybody in real life that does, and in fact aside from three or four mentions-in-passing I have never heard anybody even talk about it. Different worlds, I guess.

      EDIT: Why am I reading a Ruby article, then? That's easy... just avoiding a bit of work. Maybe I'd find that it had done something interesting.

    • lobo_tuerto 14 years ago

      I guess that your tone used when qualifying it as fad was what gained you the downvotes.

      It read like you were just trying to make waves around the subject just for the sake of it.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection