swarm-modeling
[Top][All Lists]
Advanced

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

Re: polymorphism (was compare swarm with repast)


From: gepr
Subject: Re: polymorphism (was compare swarm with repast)
Date: Mon, 12 Aug 2002 09:01:07 -0700

Just to clarify things re polymorphism.... Things have changed. [grin]

It used to be that the definition of polymorphism relied upon the 
implementation.  Polymorphism is now considered just the abstraction
of 2 or more methods having the same declaration.  But, it used to 
be identified with dynamic binding.

polymorphism = dynamically bound calls
monomorphism = statically bound calls

In those days, we also referred to two other things:

o true polymorphism = dynamically bound calls -- thereby introducing
  the "pseudo polymorphism" that was polymorphic in abstraction only,
o pure polymorphism = where no definition for that function exists 
  in the base class -- which is what Nick describes below

So, Russell is correct in that Java and C++ don't support 
"true polymorphism" (except in the case of Java's Reflection API).

How important this is to modeling is left as an exercise to the 
reader.  (Hint: Do you think two humans know a-priori which methods
the other responds to? ;-)

Nick Collier writes:
 > 
 > Hi,
 > 
 > When I saw the first message about java lacking polymorphism I was a bit
 > confused, but let it lie. Now with this second message I want to reply. 
 > 
 > Java _DOES_ support polymorphism as least as far as I understand it
 > (polymorphism that is). For example, if I have three agent types, A, B,
 > and C. The first of which, A,  is an interface (that is just method
 > signature declarations and no implementation) with say a step method.
 > The other two types, B and C, are concrete implementations of this
 > interface. They each provide a different implementation of the step
 > method that results in different agent behavior. So, I can treat B and C
 > here as type A, but whenever I call the step method on B and C their own
 > implementations are executed. B is polymorphic in that it appears as
 > both A and B to client code. A could also be a class here as well. This
 > is pretty much the way polymorphism works in C++ as well. (Methods in
 > java default to virtual.) Obj-C does much more run time binding etc., 
 > so perhaps its "more polymorphic," but Java certainly has polymorphism
 > as least as its commonly understood. A brief look at any of the 100's of
 > java books under polymorphism, as well as various design pattern books
 > with java examples confirms this. 
 > 
 > Nick
 > 
 > On Mon, 2002-08-12 at 09:45, M Lang / S Railsback wrote:
 > > Russell Standish wrote:
 > > > 
 > > > Problems with Java.
 > > > 
 > > > 1) Its slow
 > > > 2) Has too many incompatible versions
 > > > 3) Lacks operator overloading
 > > > 4) Lacks generic programming
 > > > 5) Lack multiple inheritance and polymorphism
 > > 
 > > Here are my two cent's worth, as someone who (a) has not yet given Java
 > > a serious try, and (b) has had the luxury of working with experienced C
 > > programmers on my Swarm projects.
 > > 
 > > a. I have *never* had a problem installing and running Swarm, using the
 > > packaged releases for Windows. 
 > > 
 > > b. Russell's problem #5 is to us a real one- the lack of polymorphism. I
 > > think this is the same issue Glen was getting at- Objective C gives you
 > > more flexibility to have agents of different classes all mixed up
 > > competing with each other, etc., and the model swarm not having to know
 > > what class agent it is telling to do what. I'm not sure how we could do
 > > some of our models without polymorphism.
 > > 
 > > c. Thanks for all the timely discussion as I am finishing up a draft
 > > book chapter on software for agent-based ecological models. (It is NOT a
 > > review of all the platforms out there, but instead an overview of things
 > > to think about for people getting started.) If someone is dying to
 > > review it for me, please send me a message.
 > > 
 > > Steve
 > > 
 > > -- 
 > > address@hidden
 > > Lang, Railsback & Assoc.
 > > 250 California Ave., Arcata CA 95521
 > > 707-822-0453; Fax 822-1868
 > > 
 > > 
 > >                   ==================================
 > >    Swarm-Modelling is for discussion of Simulation and Modelling techniques
 > >    esp. using Swarm.  For list administration needs (esp. [un]subscribing),
 > >    please send a message to <address@hidden> with "help" in the
 > >    body of the message.
 > >                   ==================================
 > -- 
 > Nick Collier 
 > Social Science Research Computing 
 > University of Chicago 
 > http://repast.sourceforge.net
 > 
 > 
 > 
 >                   ==================================
 >    Swarm-Modelling is for discussion of Simulation and Modelling techniques
 >    esp. using Swarm.  For list administration needs (esp. [un]subscribing),
 >    please send a message to <address@hidden> with "help" in the
 >    body of the message.
 >                   ==================================
 > 

-- 
glen e. p. ropella              =><=                           Hail Eris!
H: 831.335.4950                              http://www.ropella.net/~gepr
M: 831.247.7901



                  ==================================
   Swarm-Modelling is for discussion of Simulation and Modelling techniques
   esp. using 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]