Reflection and quotation

Kyle Lahnakoski kyle@arcavia.com
Wed, 23 Aug 2000 23:58:21 -0400



Jecel Assumpcao Jr wrote:

> On Wed, 23 Aug 2000,  Kyle Lahnakoski wrote:
> > You want to edit 4?  What would you like to do to it?  This weaving of
> > behavior and objects is a side effect of not having a normalized
> > representation of that specific domain.  If 4 has attributes, like
> > behavior, then somebody did bad design work.
> 
> In object oriented programming the number 4 typically has behavior (you
> can ask it for its successor and get 5 as an answer, for example). You
> might not like it, but I don't see how you can declare it as "bad
> design".

Maybe this needs more explanation.  You do not ask 4 what its successor
is.  You do not ask rocks about the sand they will become.  You analyze
the behavior of the integers, and produce the answer yourself, or you
ask God for the successor.  The former can be reduced to requesting the
successor of a number from the behavior.  That means the behavior is an
object, and that object should be the one handling the requests.  It
also handles such operations as addition and multiplication.  I call
this object the Integer_Class.  Notice the clean implications:  add two
numbers together is a symmetrical operation Integer_Class.add(a=4,
b=3).  

The poor method of adding integers required messages to be sent to the
numbers.  Therefore 4 + 3 was logically different from 3 + 4 in terms of
message passing.  This is bad design because you deliberately introduce
the anomaly of asymmetry for an operation that should logically be
symmetrical.





----------------------------------------------------------------------
Kyle Lahnakoski                                  Arcavia Software Ltd.
(416) 892-7784                                 http://www.arcavia.com