I was flipping through a book on C++ today and I read the rather astounding claim that implementating the Observer pattern in Java is nearly impossible because the language lacks multiple inheritence.(the book goes on the claim that the Adapter and Bridge patterns also depend on MI, which is patently false). Does anybody know the justification for this? I can’t even imagine how one could even use MI in the implementation of the Observer pattern, and GoF certainly makes no mention of MI in their description of the Observer pattern. Anyone?
You got me. We have an instance of the observer pattern in code at work, and I’m pretty sure it doesn’t use multiple inheritance. Could be someone who hates Java and doesn’t know why.
That pretty much settles it right there, doesn’t it?
Not to mention that it isn’t quite true that java doesn’t have M.I. – you can only “extend” a single class, but you can “implement” as many interface-s as you want.
Yeah, not quite the same thing, but close enough to work with when needed.