Adaptors, was Re: [Reality] getting started?

Jasper Phillips reality@twistedmatrix.com
Wed, 27 Aug 2003 16:21:08 -0700 (PDT)


On Mon, 25 Aug 2003, Glyph Lefkowitz wrote:

> 
> On Sunday, August 24, 2003, at 04:08 PM, Christopher Armstrong wrote:
> 
> > This is the _whole point_ of adapters -- separating concerns so you 
> > don't need to modify the original object to add functionality to it.
> 
> It might not be obvious why this is a good idea if you're coming from 
> elsewhere :).  The systems we've currently got in the NewReality module 
> are pretty thin.  Our goal is to expand them in flexibility (and 
> therefore complexity) as much as we possibly can.  Eventually, you 
> should be able to create a nylon rope which can be tied in a knot, tied 
> to other objects, thrown out the side of a building, climbed up, 
> climbed down, attached to a grappling hook and thrown, stretched, 
> broken, cut, burned, used as a fuse on an explosive device, bitten 
> through, eaten, digested by appropriately engineered animals and later 
> excreted as crude oil and/or fissionable uranium.  Each of these 
> different actions is a small system which has to be independently coded 
> - and remember, we're just talking about rope, there!  The more 
> separate that we can keep the systems (for example, the burning system 
> should not need to know about climbing, even though the rope can be 
> used for both of these), the easier it will be to keep a manageable 
> amount of complexity in each module but still get a very flexible end 
> result.

<delurk>

This is quite cool, and overall IMHO the right direction to go (similar to
Aspect Programming, and a good use for it).  However, it is also very
ambitious...

Abitious enough that there is still going to be a fair amount of local
complexity (just how does a rope burn?  How do stretching, cutting, and
climbing interact?  Is a knotted rope easier to climb? etc.). This complexity
may mostly be in the form of data fields, but probably some methods as well.

How do you deal with such methods?  Do you place them on what needs them and
call them via reflecteion, or do you extend the adaptors to keep track of
all such complex interactions (if so what about code dealing with
interactions between 2 adaptors)?

Curious,
-Jasper