Re: deriving from PangoLayout



Owen Taylor <otaylor redhat com> writes:

> And I don't think subclassing is the appropriate mechanism
> for doing ellipsization....  you really don't want to even

Subclassing might not be the appropriate mechanism for extension at
all.  The problem with subclassing is that subclasses are very tightly
coupled with their parents.  Essentially, allowing a class to be
subclassed for code resuse is exposing a very large and complicated
API that has to be maintained and supported.

It is almost always better to allow features to be plugged in with a
simple, well-defined API (the 'strategy' design pattern, for those who
like to think of design that way).

I haven't read the PangoLayout code, so I am not really being helpful,
I know.  I just think decisions to allow users to subclass a
non-abstract class should be considered carefully.

Søren




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]