Simulator design question

Ned Konz ned at bike-nomad.com
Fri Sep 7 17:11:57 UTC 2001


On Friday 07 September 2001 10:33 am, david at aminal.com wrote:

> The Ultimate Goal is to be able to unhook the node code from the simulation
> and connect it to a real network - so I'm finding myself spending a lot of
> time thinking about how to avoid dead ends where the node code is too
> tightly coupled to the simulation code.

A pattern that I've used in the past is to have pairs of classes with the 
same interface: that is, a SimulatedXXX for every real XXX that can be 
simulated.

And I use a factory method to generate them that knows what part of the 
system is simulated (actually, I've used a serialized tree (Dictionary of 
Dictionaries) where each leaf represents a concrete object, and there is a 
flag as to whether or not each sub-tree is simulated). So when the Network is 
generating NetworkNodes or whatever, it looks to see whether the nodes should 
be simulated and makes a SimulatedNode or a Node.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com




More information about the Squeak-dev mailing list