Java/C# "interface" in Ruby ?

P

Peter Fitzgibbons

------_=_NextPart_001_01C59E7F.383598C9
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hello all,

This is a newbie question.
Is there anything in Ruby that is equivalent to the Java/C# "interface".


Peter J. Fitzgibbons
Applications Manager
Lakewood Homes - "The American Dream Builder"(r)
(e-mail address removed)
(847) 884-8800=20



------_=_NextPart_001_01C59E7F.383598C9--
 
A

Austin Ziegler

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.

Mixins work better than "interfaces" ever will.

-austin
--=20
Austin Ziegler * (e-mail address removed)
* Alternate: (e-mail address removed)
 
R

Robert Klemme

Austin said:
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
 
J

James Edward Gray II

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
 
D

Daniel Berger

James said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top