Right. Too much Java on my part. I forgot that it can still be overridden if private.Originally Posted by Daved
Although you could perhaps make a case that private functions are an implementation detail of the class itself that subclasses shouldn't know about - how then can they know to override it?
Sure. I looked it up at Wikipedia and the article is just confusing me. It starts in the introduction:Originally Posted by Mario F.
I think what the author meant is "when not only what the class does changes often but also how it does it." Although this should be the other way round: if what the class does changes often, then its interface is incomplete and thus flawed. Whereas changes in how it does it are the whole point of polymorphism.The bridge pattern is useful when not only the class itself varies often but also what the class does.
The article then goes on to first describe interaction of shapes and drawing systems, and then cars and roads. In both cases, the impression I get is that here are two distinctly separate hierarchies (in the first case a hierarchy of shapes and a hierarchy of drawing engines, and in the second case a hierarchy of cars and a hierarchy of roads) that interact through their well-defined interfaces like the very basics of object-oriented design dictate. Yet the article makes the claim that there is a special pattern here because of the road somehow being an implementation detail of the car, or the GFX one of the shape, and that separating these into two hierarchies is a pattern.
That's nonsense IMO. It's just separation of concerns. It may be a pattern, but it's such a fundamental part of OOD that giving it yet another name is pointless, as I see it.