comp.lang.ada
 help / color / mirror / Atom feed
From: Vinzent 'Gadget' Hoefler <nntp-2005-05@t-domaingrabbing.de>
Subject: Re: Interfaces
Date: Tue, 17 May 2005 13:34:12 +0000
Date: 2005-05-17T13:34:12+00:00	[thread overview]
Message-ID: <1632446.44CstxF7BU@jellix.jlfencey.com> (raw)
In-Reply-To: 874qd2cedk.fsf@deneb.enyo.de

Florian Weimer wrote:

> * Vinzent Hoefler:
> 
>> Florian Weimer wrote:
>>
>>> I wasn't sure, after reading the Java language specification, if
>>> Java interfaces had the same problem. 8->
>>
>> They do.
> 
> And this behavior doesn't cause problems in practice?  Of course, this
> would be a rather strong indicator that no additional complexity is
> necessary. 8-)

Well, the idea behind this is: If you implement two interfaces which
share methods with the same name (and signature), you most likely wanted
to implement only one of these methods anyway, so there actually is
only one, no matter how many interfaces share this method.

I'm not sure if I agree with that particular view point "there can be
only one", but that's what an 10-year Java-Professional was paid to
tell us ;-> and it seems like a clever trick to avoid the problems you
would get otherwise.

Ok, some code to make the point more clear:

interface Int_A {
   void Foo();
   void Bar();
}

interface Int_B {
   void Foo();
   void Baz();
}

class One implements Int_A, Int_B {
   void Foo() { ... }; // required from either Int_A or Int_B
   void Bar() { ... }; // required from Int_A
   void Baz() { ... }; // required from Int_B
}

Ok, so far so good. Now the "tricky" part:

class Two implements Int_A {
   void Foo() { ... }; // Int_A
   void Bar() { ... }; // Int_B
}

class Three extends Two implements Int_B {
   void Foo(); // surprise! already implemented by "A.Foo()"!
               // so this is an override of "Two.Foo()"
   void Baz(); // required from Int_B
}

So in this case "class Three" actually only needs to implement "Baz()"
from "Int_B", because "Foo()" was already implemented by "Int_A".

I don't know if Ada interfaces are supposed to have the same behaviour,
but if they do, this doesn't seem much of a problem, since the Java
community seems to be quite satisfied with the solution. Or perhaps
they just don't know better. :->


Vinzent.

-- 
worst case: The wrong assumption there actually is one.



  reply	other threads:[~2005-05-17 13:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-16 12:27 Interfaces Florian Weimer
2005-05-16 16:13 ` Interfaces Georg Bauhaus
2005-05-16 16:12   ` Interfaces Florian Weimer
2005-05-16 18:59 ` Interfaces Robert A Duff
2005-05-16 19:27   ` Interfaces Florian Weimer
2005-05-16 20:09     ` Interfaces Robert A Duff
2005-05-16 20:44       ` Interfaces Florian Weimer
2005-05-17  6:14     ` Interfaces Vinzent 'Gadget' Hoefler
2005-05-17 10:53       ` Interfaces Florian Weimer
2005-05-17 13:34         ` Vinzent 'Gadget' Hoefler [this message]
     [not found]         ` <4289f382$0$10805$afc38c87@>
2005-05-17 16:51           ` Interfaces Pascal Obry
     [not found]             ` <428a2832$0$10805$afc38c87@>
2005-05-17 18:15               ` Interfaces Pascal Obry
2005-05-17 21:11                 ` Interfaces Florian Weimer
2005-05-18 10:36                   ` Interfaces Georg Bauhaus
2005-05-17  7:36     ` Interfaces Dmitry A. Kazakov
2005-05-17  9:06       ` Interfaces Florian Weimer
2005-05-17 10:19         ` Interfaces Dmitry A. Kazakov
2005-05-17 10:57           ` Interfaces Florian Weimer
2005-05-17 11:13             ` Interfaces Dmitry A. Kazakov
2005-05-17 15:35               ` Interfaces Robert A Duff
2005-05-17 21:53                 ` Interfaces Florian Weimer
2005-05-17 23:21                   ` Interfaces Randy Brukardt
2005-05-17 23:44                     ` Interfaces Marius Amado Alves
2005-05-18  7:53                     ` Interfaces Dmitry A. Kazakov
2005-05-18 16:57 ` Interfaces adam
2005-05-20  5:31 ` Interfaces Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox