From: Daniel Berger Date: 2005-08-11T23:59:22+09:00 Subject: Re: Java/C# "interface" in Ruby ? James Edward Gray II wrote: > On Aug 11, 2005, at 9:41 AM, Robert Klemme wrote: > >>> Mixins work better than "interfaces" ever will. >>> >> >> I beg to differ here: mixin modules provide implementaitions while >> interfaces just define method signatures. IMHO mixin modules are better >> compared to multiple inheritance or reuse. > > > Yeah, I have to agree here. To me, the Ruby equivalent of interfaces > would be Duck Typing. > > James Edward Gray II I released "interface" on the RAA, mainly as proof that interfaces *could* be done in Ruby if you really wanted them. Note that I've never used it in actual production code. The *only* Ruby library I've seen so far that *might* benefit from an interface is DBI, where you want to ensure that all of the DBD's have a common set of methods. Even then, it's easy enough to simply document what methods should be defined and what they should do, then add a generic test suite which DBD writers can use to ensure correctness. Regards, Dan