ALU capability (was Re: [E-Lang] Authority -- what is its dual?)
Tue, 23 Oct 2001 10:48:37 -0700
Jonathan A Rees wrote:
- It [object-oriented programming] accounts poorly for symmetric
such as chemical reactions and gravity.
And I received email asking me what we were talking about regarding
Chemistry is a good example. Suppose you have programmed hydrogen and oxygen
atoms and now want to program them joining to form a water molecule. Do you
add some behavior (e.g. a method) to hydrogen or oxygen and therefore
implement an asymmetric solution to a problem that seems symmetric?
I think Jonathan is arguing that a pure object-oriented system handles these
kinds of examples poorly while some languages (e.g. CLOS) allow you to write
a multi-method that deals with the interaction of hydrogen or oxygen without
forcing the code to be part of one or the other. A major problem here is
that multi-methods and chemistry don't seem to respect encapsulation.
It seems that chemistry has inspired theoretical work on a model of
computation. See for example
I found it a refreshingly different way to think about computation. (Though
I only read one paper years ago so don't expect me to be able to answer
questions about it.)
On the topic of gravity that Jonathan brought up I'm not sure that it is an
example of awkward handling of symmetric interactions. Back in the late 70s
I worked an object-oriented gravity program for pedagodic purposes (like a
Logo microworld but in an object-oriented language). Each object with mass
contacted every other object with mass and asked for the other's location
and mass. Each object then computed and added the gravitional forces that
all the others exerted on it. Seems symmetric to me. And it is something a
high school student or younger could program unlike the continuous
alternative based upon calculus.
It is true that this implementation of gravity is approximate because you
sample at time intervals. But it is also a framework that can more easily
grow into a fun little space war game by making objects with mass that also
have thrusters and weapons.
-ken kahn ( www.toontalk.com )