I am really enjoying your book, with a tiny but...
15 Dec 2010, 23:02
Richard McIntyre (1 post)
I am really enjoying your book. You have made a potentially complicated topic very easy to read and I am enjoying the style as others have commented.
I only started it a couple of Days ago and am still on Monday or Tuesday - I cant remember.
The tiny but I refer to (please don’t confuse with Butt) is when you bring in class and superclass relationships, I feel the book does not explain the difference well enough of the difference between these two. I had to look online for a more specific definition of superclass. What do you think?
21 Dec 2010, 11:31
Paolo Perrotta (49 posts)
Hello, Richard! I’m glad that you’re liking the book (and even more glad that there are no butts involved).
When I was learning Ruby (coming from Java), that difference between class and superclass confused me as well. My problem was that I wasn’t used to see both class and superclass relationships as simple relationships between objects, because classes are not really objects in Java - so an object’s class and a class’s superclass were entirely different types of relationships for me.
Things are actually simpler in Ruby, but it took me some time to get rid of my complicated worldview. Every Ruby object has a class, including classes (because they’re objects). On the other hand, classes are specialized, so they have something more than regular objects: in particular, they have a superclass, while regular objects do not. So an object only has a class, while a class (that is a specific type of object) has both a class and a superclass. Whoa, I hope I didn’t make it even more complicated. :)
In the book, I tried to make it clear that both “class” and “superclass” are just links from one object to another, and I used an old trick to show that they’re different links: I drew all the diagrams so that an object is sitting to the left of its class, and a class is sitting below its superclass. I guess this doesn’t really sink in until you realize that classes are just objects, and it’s still not easy to grasp the difference until you really grok method lookup.
If you can think of any example that might have helped you “get” the difference earlier, by all means let me know - it might come useful for a second edition. Enjoy the rest of the book!
|You must be logged in to comment|