[reportlab-users] Re: [reportlab-team] widgets/markers.py

Dinu Gherman reportlab-users@reportlab.com
Sat, 3 Aug 2002 11:10:15 +0200


Robin Becker:

> Well how about the following which subclasses Marker in a few lines.
> All the old behaviour is there and you have a new marker. The 
> polymorphic
> refers to different shapes from the same class. I realize this may not
> look like OO to you Dinu, but it seems to work.

Well, making it work is only a first step. ;-)

What I don't see it what requirement there was to make all "standard"
markers have the same class and be distinguished by a 'kind' attribute?
Why not a subclass for each of these markers? Why should I want a
DinuMarker of a 'Diamond' kind? Why should each marker know how to
draw each kind of them?

With a subclass there is no more need for a non-OO style 'kind' attri-
bute, no need for a dedicated method, differently named for all kind
of markers (which is not polymorphic), no more underscore ugliness,
no more breaking the convention of underscored methods being private
and not needed to be implemented in subclasses.

The same kind of reasoning probably applies to widgets/flags.py.

Dinu