Carl Banks schrieb:
On Apr 22, 11:10 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
2. Java interfaces solve a different problem than MI (used properly)
does: interfaces are there to make types polymorphic, whereas
inheritance's main use is to share behavior.
But the *goal* of the polymorphy is mainly to have shared behavior.
Not at all. The goal of polymorphism is to have objects of different
types usable in the same situation. Two such classes might share some
behavior, but they don't have to.
Of course they don't *have* to. Yet very often they do. But I should
have (again) worded that more cautiously.
When doing Java, using interfaces like the ones found in the collection
packages or e.g. HttpServletRequest and such usually leads to the
delegation-pattern I described. The same for swing. Generally, a lot of
code is written that declares first an interface & then some
Impl-classes of that - for the sole purpose of working around the
SI-caveats.
This shaped my viewpoint of interfaces - while on their own useful - as
a necessary crutch to create a MI-like features, that I wanted to
emphasize in this discussion.
Diez
--
http://mail.python.org/mailman/listinfo/python-list