|
From: | Hilaire Fernandes |
Subject: | Re: [Dr. Geo] DrGWrappedPoint versus Point |
Date: | Sun, 21 Apr 2024 14:12:07 +0200 |
User-agent: | Mozilla Thunderbird |
Regarding the abstraction with the Wrapped object, these middle man exist not because distinction between Smalltalk Point (5@5) and DrGeo Point but because for each geometric object, you have underneath several objects involved: the model (DrGMathItem class hierarchy), the view (DrGMorph hierarchy) and the style (DrGStyle). When programming Smalltalk sketch, you don't want
the user to deal with this distinction. Therefore the wrapped
object will handle the message and forward it to the appropriate
object(s), the model, the view or the style. It makes the user
code more elegant and compact. Observe how the complexity is hidden to the user: DrGWrappedPoint>>coordinates ^ self mathItem point DrGWrappedPoint>>round self style shape: #round DrGWrappedItem>>hide self style hidden: true. morph forcedVisibility: false.
In your Smalltalk sketch, if you want some
description regarding your object, you can ask its model: segment mathItem then send #printText or
#descriptiveName. Browse the DrGMathItem class and its parents
Le 21/04/2024 à 12:46, stes@telenet.be
a écrit :
I was not aware of the hide and show messages, I'll first test that. So I was not asking to change anything ... but I was just surprised to see that the points are actually instances of a class named DrGWrappedPoint (this makes sense of course, as it is a layer of DrGeo on top of the basic Smalltalk or Cuis Point class). I'll first test some other examples ... -- GNU Dr. Geo http://gnu.org/s/dr-geo/ http://gnu-drgeo.blogspot.com/ |
[Prev in Thread] | Current Thread | [Next in Thread] |