Collective Behavior
Shark shark = new Shark();
Collection<Fish> swarm = new ArrayList();
for ( ... ) swarm.add(new Fish());
...
swarm.mimicryAttack(shark);
Swarm Behavior is a new composition operator that associates behavior with a collection of instances. The lookup of swarm behavior is based on the element type of a collection and is thus orthogonal to the collection hierarchy.
The method mimicryAttack
…
- is defined in the lexical scope of the
Fish
class, - is available for all subtypes of
Collection
, but - limited to collections that contain
Fish
instances. - can be overridden by subclasses of the
Fish
class.
NB, useful for both static and dynamic languages.
Publications
-
Adrian Kuhn, David Erni, Marcus Denker, "Empowering Collections with Swarm Behavior," to be submitted to somewhere sometimes, (mail us to get a copy).
-
David Erni, "JAG – a Prototype for Collective Behavior in Java," Technical Report, University of Bern, August 2008, Bachelor's thesis.
-
Adrian Kuhn, "Collective Behavior," Proceedings of 3rd ECOOP Workshop on Dynamic Languages and Applications (DYLA 2007), August 2007.
Downloads
- For Ruby, see Swarm Behavior in Ruby, just a quick hack...
- For Smalltalk, http://www.squeaksource.com/CollectiveBehavior.html
- For Java, @erni/dist/jag.zip (tutorial see appendix of David's thesis)
People
- Adrian Kuhn
- David Erni