Actually, it is. I've worked for many different companies, both large and
small, and almost everybody uses it. I find it very hard to believe this
isn't the norm.
In all honesty, I've used it quite a bit, and people I've worked with (many,
very hardcore OO purests) have also used it quite a bit. Does this mean
people may have overused it? Possibly. But this happens with every
technology.
With .Net, it's especilly frustrating, as your inheritence tree is often
dictated to you by the platform. With my inheritence tree defined (web page,
control, EnterpriseComponet, or whatever), adding my my own behavior means
alot of mindless (and often silly) code duplication. Some of this is
mitigated in .Net 3.5, with Extension Methods, but by no means all of it.
I didn't say it wasn't powerful. The mechanics get progressively more
difficult to work with however as class hiearchies become non-trivial.
The exact same can be said of dozens of technologies:
- Threading technologies.
- Dynamic Code Generation.
- Operator Overloading
Any of these can be, and often are, badly abused.
VB 1-6 didn't have any of them, and the world got along just fine. Tons of
code was written. Obviously they're not needed at all. Clearly this means
even inheritence isn't required, as developers (as Microsoft document from
that era made very, very clear) often screw it up, and Interfaces are a far
superior technology.
You must have precious little experience dealing with large class
hierarchies then..
Yeeeea. That's what it is.
When you factor in issues like virtual base classes, the calling of their
constructors from the most dervied class (which refutes your claim that
MI is widely used since very few C++ programmers even know about this),
the headaches involved with ambiguity (a major pain), etc., then it
becomes a major deterrent very quickly unless your class hierarchies
remain trivial.
I'm afraid I don't follow your logic.
The classic MI "Dreaded Diamond Pattern" is certainly on the "don't do this"
list, and need to be worked around with good design. All of the C++ guys
I've worked with have either been aware of this, or quickly been made aware
of it by their peers. I don't see how this changes anything - all of the
advanced technologies have drawbacks that can be, and often are, abused.
For example, threading. Where do you do locking and synchronization? What
thread context is your method running on? Can you access these other classes
or do you need to lock? Are there others calling you from inside a lock - if
so, that database call you're about to make is a really bad idea). Unless
your class hierarchy is trival, these are really hard question. Much harder,
in my opinion, than solving the MI Diamond issues.
For example, anything distributed. Where are you running? In what context?
Is there a network between you and your processor? Should you build chatty
or chunky methods? Can you call this other class at all?
The list goes on....
I'm fine requiring users to take MCP exam 70-666 (Multiple Interitence),
which gives them a key they can put into their compilers to unlock MI.