[self-interest] "Organizing programs without classes"

David P Harris dpharris at telus.net
Mon Nov 10 19:07:30 UTC 2003


Hi-
When you send a 'draw' message to the original object, you access the 
draw method in the parent, however, it is applied to the original object 
that has the vertices. 
David

Jecel Assumpcao Jr wrote:

>On Monday 10 November 2003 08:35, J. Baltasar GarcĂ­a Perez-Schofield 
>wrote:
>  
>
>>["polygon traits"=>draw(),copy()
>> "prototypical polygon"=>parent,"vertices"]
>>    
>>
>
>Slots with names ending in "*" indicate parents.
>
>  
>
>>         My question is: How's that possible ?
>>         I mean, if the "draw" method is declared in the parent
>>"traits", then it has no access to the vertices list, as they are
>>declared in the "prototype".
>>    
>>
>
>Exactly. Sending 'draw' to 'traits polygon' will get you a "message not 
>understood" error. That really bothers some people, though I don't 
>worry much about it.
>
>  
>
>>So it is impossible to write a complete "draw" method.
>>    
>>
>
>Not if you think of 'vertices' as a method instead of an attribute.
>
>  
>
>>I suppose the list of vertices is declared in the
>>"traits" object, at least in a minimalist way, and then repeated in
>>its full format in the prototype polygon.
>>    
>>
>
>No, it is not present at all in the traits (and so 'draw' simply doesn't 
>work for that object) but entirely defined in the prototype (so 'draw' 
>does work for it, even though it is actually not defined in that object 
>but inherited from the parent).
>
>  
>
>>         Or perhaps the "draw" method in the traits object is an
>>empty one, and the method is repeated in the polygon prototype
>>object.
>>    
>>
>
>Not that either. What you are missing are the advantages of entirely 
>hiding state (attributes) behind behavior (getter and setter methods). 
>For any object that inherits the 'draw' method and also understands the 
>'vertices' message, 'draw' will work just fine.
>
>-- Jecel
>
> 
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
>
>
>
>  
>





More information about the Self-interest mailing list