This content has been marked as final. Show 35 replies
I don't run into name collisions that much either; but that isn't a Java language
Yep, Java simply annihilates the problem by not offering the nasty (butI've never really run into this though. I think it only really comes up frequently (if
powerful) MI of implementation ... it doesn't deal with name
collisions from different interfaces though, which I find a bit ugly. (all
IMHO that is).
that) when developers think that they have to have a single class that
implements a billion different interfaces. Usually I find it more clean to use
inner classes (etc.) to implement non-primary interfaces.
problem, it's a natural language problem where we have to deal with homonyms
(words/verbs that mean different things, but are written identically), the verb 'draw'
is a nice example here ...
BTW, if a class implements a zillion interfaces, that class exhibits a lot of 'faces'
(sic) and deserves to run into trouble by its sheer (mis)design ;-)
Jos (implements Sleepy, Thirsty, Tired, StillHungry, LotToDo, NeedsADrink)
Well, Eiffel supports multiple inheritance (does not have interfaces), but deals with the diamond problem in a ad-hoc way . From the documentation:
Robust multiple inheritance facilities are essential to support combining various abstraction s and reusable components. The Eiffel-unique mechanisms of renaming (to eliminate name clashes), "join", and "select" (removes ambi guities from multiple redeclarations) ensure a powerful tool that dramatically improves both modeling and design/implementation
Another Eiffel article:
why multiple inheritance is not allowed in java?Simple: because James Gossling doesn't like it and he wrote the language specs.
Since the language specs define the language and MI is not allowed according to the language specs MI is not allowed.
No other reason is needed. You could just as well ask why Java is case sensitive or why the sun is pink.