Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why Use Interfaces
Message
 
To
03/01/2008 20:12:30
General information
Forum:
ASP.NET
Category:
Class design
Miscellaneous
Thread ID:
01278205
Message ID:
01279385
Views:
33
>>>... Interfaces can be used to simulate multiple-inheritance. And there's nothing wrong with using them this way.
>>
>>Nothing wrong? I believe that this is, at least, debatable.

>
>OK, I'm always up for a good debate ... what are your objections?
>
>~~Bonnie

I believe that multiple inheritance (MI):
- in most cases, shows a flaw in design.
- and almost always generates maintenance problems.
I put MI in the same category with things like the Scope Resolution Operator, or event binding. We all hated spaghetti code (sometimes, even if it was our code) for the mess it created, but we were all so happy to get the :: and event binding.
A complex class hierarchy that uses single inheritance could be challenging, but with MI you can really make it like spaghetti.

I know that in real life we have to compromise, sometimes, and for valid reasons, use interfaces to simulate MI. Some say MI is good, and some say MI is bad - I don't know if there is a clear winner, but I am on the side that believe there is enough wrong with MI. Maybe you meant there is nothing wrong technically, i.e. you can do it, which is true.

I wasn't actually looking for having the debate here, there are people way better than me to do it. I just felt "nothing wrong" was too strong.
Doru
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform