[Cuis-dev] PlacedMorph vs BoxedMorph
Hilaire Fernandes
hfern at free.fr
Thu Sep 5 06:56:52 PDT 2024
Le 01/09/2024 à 17:55, Juan Vuletich a écrit :
>>
>> Indeed, PlacedMorph has BoxedMorph as its only heir. Moreover, there
>> is no instance of PlacedMorph.
>>
>
> Not quite:
> PlacedMorph subclasses ->
> #(BoxedMorph Sample01Star Sample02Bezier Sample03Smiley Sample04Pacman
> Sample06EasyToGrab Sample07Clipping Sample08Form Sample09Clock
> Sample09ClockHourHand Sample09ClockMinuteHand Sample09ClockSecondHand
> Sample10PythagorasTree) .
I obviously miss looked. I also have PlacedMoprh subclasses of my own I
forgot about, to represent geometric instruments.
>
> PlacedMorphs are not expected to be "boxes". That's the big
> difference. They are also not assumed to be resizable. That's why
> having an instance variable to hold something like 'extent' is not
> appropriate for them.
>
>> *I am wondering if moving the extent attribute of BoxedMorph to
>> PlacedMorph *would be useful.
>>
>
> I don't think so. It is important to have a superclass for Morphs that
> are not rectangular shapes, or have their own idea of how to handle
> their size / extent.
Ok, thanks for the recall.
>
> I understand your need. I think a better hierachy would be something like:
> Morph
> PlacedMorph (location)
> BoxedMorph (extent)
> ColoredBoxedMorph (color, borderWidth, borderColor)
> Many subclasses here
>
> The problem with this approach is that a lot of code is already
> subclassing BoxedMorph. It may be more reasonable to add a new class
> between PlacedMorph and BoxedMorph. Something like:
> Morph
> PlacedMorph (location)
> BasicBoxedMorph (extent)
> BoxedMorph (color, borderWidth, borderColor)
No, please don't. I think it will add unnecessary complexity. I prefer
to have unused attributes in some cases.
Bernhard prospective are interesting, it is a refoundation of the
architecture. It will make the system less easy to understand IMHO.
Hilaire
--
GNU Dr. Geo
http://gnu.org/s/dr-geo/
http://gnu-drgeo.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240905/2ef2dd34/attachment.htm>
More information about the Cuis-dev
mailing list