From: Gavin Sinclair Date: 2003-01-02T23:56:24+09:00 Subject: Re: Interfaces in Ruby On Friday, January 3, 2003, 1:49:55 AM, Robert wrote: > since ruby is dynamically type in principle there is no technical need for > interfaces. however, if i want to define an interface - say for reasons of > documentation - what is the suggested way to do so? create a class with a > set of methods returning 'nil' or 'self'? or create a method, that checks > the interface of an instance and raises a TypeError if any of the methods is > missing? what would you suggest? The latter is the approach I took on my most recent Ruby project. I was pretty happy with it. These were abstract classes, not interfaces (in Java parlance), but the point remains the same. My exact code in the methods was: raise "This method needs to be overwritten" Cheers, Gavin