swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Defininng and using an object as a Swarm and a SwarmObject at the s


From: Joseph E. Villa
Subject: RE: Defininng and using an object as a Swarm and a SwarmObject at the same time.
Date: Fri, 19 Mar 1999 13:43:15 -0800

It seems what you've proposed is multiple inheritance. There's certainly
a lot of discussion in OO design about multiple inheritance, and some
would have you believe it is inheritantly (*g*) problematic from a pure
design perspective. (I tend to stay away from multile inheritance, but I
suspect this is one of those religious fervor topics.) 

You may be able to achieve multiple inheritence by including the
SwarmObject.h and Swarm.h files in your Population files. (Cruising
through some of the root Swarm classes, I think I came across this.)
After that, you can specialize MalariaPop from Population. (I'm assuming
that MalariaPop has some unique structural characteristics which require
specialization. If not [i.e., if MalariaPop is different that
SomeOtherPop based on state variables alone], I'd suggest you
instantiate Population as malariaPop.)

My question would be: why do it?

Alternatively (and perhaps even preferably), I'd think that you'd want
to subclass MalariaPop from Swarm; subclass MalariaGerm from
SwarmObject; and create malariaList [an instance of the List object]
that is associated with MalariaPop and holds all of your MalariaGerms.
(see simpleSwarmBug2. In your case, ModelSwarm = MalariaPop; malariaList
= bugList; and MalariaGerm = Bug.) [For those interested in such things,
I've posted the proposed design using UML notation on my web site at
http://home.earthlink.net/~thevillas/SWARMweb/SWARMsupport/W.S.Shu/UMLDe
sign.htm.] Because instances of MalariaPop are objects, you can
communicate with & treat them as such; as a subclass of Swarm,
MalariaPop can handle building, scheduling, activating, and so on. With
malariaList in place, you can also deal with all of the instances of
MalariaGerm collectively. 

I think Paul Johnson's suggestion also seems promising. I would think
you would pursue his direction if you are interested in having multiple
populations of MalariaGerm instances existing concurrently. I don't know
much about the disease mechanisms for malaria, but it seems that your
domain requirements would drive your approach (e.g. if malaria stems
from a single point of infection and remains largely intact as a disease
body, you  may use my approach. If malaria begins in multiple points of
infection or has a tendency to fragment into smaller populations of
germs, it seems you'll need to take Paul's approach). 

Good luck and let us know where you end up,

Joseph Villa






-----Original Message-----
From: William S. Shu [mailto:address@hidden
Sent: Friday, March 19, 1999 10:27 AM
To: address@hidden
Subject: Defininng and using an object as a Swarm and a SwarmObject at
the same time.


Please help me find practical ways of expressing the following
conceptual
problem in Swarm (and adhere to Objective C requirements as well)
exemplified by:

@interface MalariaPop:Population:SwarmObject
{
 ...
}
 ...
@end;

@interface MalariaPop:Population:Swarm
{
 ...
}
 ...
@end;

MalariaPop is a population of malaria germs, and hence it is a kind of
population.  Inside a person, I am interested in the malaria population
as
an object, and so I define it as a swarmObject.  But MalariaPop contains
malaria germs, whose interactions I may also want to consider.  So I
define
MalariaPop as a Swarm!

Using different names (e.g. MalariaPopSwarmObject and MalariaPopSwarm)
seems
to make two classes of the same thing, and I would probably have to
allow
for this distinction in the code.

Now the Questions (probably trivial):
a)    How can one define a given object simultaneously as a Swarm and a
SwarmObject.

b)    Having successfully defined it, any hints on how to switch between
its
two "states", or those in between?  i.e., to be treated completely as an
object, or completely as a swarm, or simultaneously (?) as a bit of
both!

c)    How do I avoid defining intermediate classes for Population:Swarm,
Population:SwarmObject.  They are not a result of my problem conception
and
seem to distract.  At any rate, if they must exist, how do I hide them
and
ensure they are "transparent"?

Thanks,

William




                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]