This is a newbie question.
Is there anything in Ruby that is equivalent to the Java/C#
"interface".
Depends. The standard answer is "thank ghu, no." There are some
third-party implementations on the RAA, but you don't need them.
Agree.
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.
Kind regards
robert
···
On 8/11/05, Peter Fitzgibbons <Peter.Fitzgibbons@lakewoodhomes.net> > wrote:
Yeah, I have to agree here. To me, the Ruby equivalent of interfaces would be Duck Typing.
James Edward Gray II
···
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.
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.