07 Mar 2011, 15:44
Jim-maher_pragsmall

James D. Maher (5 posts)

The Object diagram is elegantly simplistic and useful.

When you introduced the diagram, you said “We always draw the class to the RIGHT of the object”. I love words like “always”; it lets me believe that concepts CAN be simple.
But, when you describe the method search (to succesive super-classes), you draw the super-class ABOVE the child class. Why not to the RIGHT?

Isn’t the String class just an instance of the Object class? So, shouldn’t each succesive super-class just be drawn to the RIGHT? Or, am I over-simplifying?

Of course, such diagrams would get very wide and unwieldy. And, you could adjust the verbiage to say “follow the arrow”. However, rigid consistency to the practice of always drawing the class to the RIGHT would absolutely crystalize the idea (at least, for me). Consistent visual repetition would really drive the point home, maybe enough for me to truly internalize the concept.

On the other hand, maybe I’m just wrong?

Jim

01 Feb 2012, 14:10
Dave_gnome_head_isolated_pragsmall

Dave Thomas (338 posts)

Yes, String is an instance of object. But it is also a child of Object. When we’re doing method lookup, we aren’t following “instance_of”, but we’re looking up the chain at the parent.

  You must be logged in to comment