From: Robert Feldt Date: 2001-11-30T14:13:25+09:00 Subject: [ruby-talk:27025] Re: thoughts on virtual base classes, interfaces On Fri, 30 Nov 2001, Phil Tomson wrote: > So I got to thinking that perhaps I could make something like a virtual > base class where you raise an exception if 'run' isn't defined in the > inheriting class. But then I thought, "why bother" - Ruby is dynamic, any > object which responds to 'run' is going to work. So perhaps the best way > of communicating this to users of the framework (a task distributor which > distrubutes tasks to different clients). So it seems that > philosophically, the best way to do it is just to document the required > (and optoinal interface) for the classes of objects to be distributed. > I tend to use an "abstract base class" with raise NotImplementedError to document this. Not for Ruby's sake but as documentation. A smart doc tool would parse it out and call the class and interface and mark the method as "virtual" or whatever it should be called. Regards, /RobertF