From: Richard Kilmer Date: 2003-02-12T06:45:15+09:00 Subject: Re: inheriting from base classes On Tuesday, February 11, 2003, at 04:15 PM, dblack@candle.superlink.net wrote: > >> The point I'm trying to make is that the ultra-dynamic features of >> Ruby are generally used in libraries, frameworks, etc., behind the >> scenes. When John Q Programmer sits down to nut out an application, >> he is 99% likely to take a similar approach in Ruby as he would in >> Java, except that he notes he is free to do many things should the >> need arise. That is: identify some classes, perhaps a hierachy, >> imagine the relationships between them, and bang out some >> (conservative) code. Test and repeat until it works. > > But we *are* behind the scenes here. At least, that's the interesting > part to me :-) You're probably right statistically -- I'm just > intrigued by other possibilities, and curious about their viability. I don't know. I am nut'in out a production Ruby application, and I just did this yesterday (simplified and names changed to protect innocent): class Foo def override_me end end myFoo = Foo.new def myFoo.override_me #do something cool end Now, i could have created a subclass and instantiated it (which is what I did do, but not explicitly.) class MyFoo def override_me #do something cool end end myFoo = MyFoo.new This would be a very Java thing to do...but adding the method to the object instance just felt (and worked) right. Java has no such capability. Having written literally hundreds of thousands of lines of production Java code (and a fair bit o' Ruby production code) I approach the two very differently and the way I use classes, modules and objects is the main difference. -rich