March 2018


Options: Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Eric 'Siggy' Scott <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Thu, 15 Mar 2018 16:23:32 -0400
text/plain (2747 bytes) , text/html (3710 bytes)

I can't speak to the actual rational behind SimState, but I can say that
I've had similar frustrations in the past.  I do think that the "God
object" approach is a bit easier for newcomers to learn.  It's easier to
think in terms of an agent that "reaches out into the world and does stuff"
than an agent that "is handed exactly what it needs and only what it needs
as references at construction time, and works only with those references to
affect the world" (which is the approach I naturally gravitate toward).

But if you aren't careful, boy can it make unit testing frustrating!  To
say nothing of tracking down weird unintended side effects.

The solution I've settled on is to make sure that my "God object" can
easily be partially initialized with only the components that are needed to
provide indirect inputs and outputs to the agent under test.  This
minimizes the need for stubbing and mocking, and arguably isn't any more
difficult than testing an agent that takes references to data it needs at
construction time.


On Thu, Mar 15, 2018 at 11:28 AM, Simon Sohrt <
[log in to unmask]> wrote:

> I don't have a question about how to use some part of mason, but I am
> rather curious about the reasoning behind the architecture of the interface
> Steppable.
> Why was the method step(SimState state) designed to take a parameter?
> If my agents directly implement the interface Steppable, my agents have
> access to all other objects in my simulation which makes my agents hard to
> unit-test (since I have to initialize the 'god-object' SimState to call the
> step-method).
> I am aware that I can circumvent this by creating a Steppable as described
> in the manual on page 109:
> Steppable even = new Steppable() { public void step(SimState state) {
>; }};
> But isn't this a little bit ugly from a design perspective, because the
> parameter state is completely ignored by
> I am also aware that I can use the sim.engine.MethodStep-method to avoid
> passing the SimState, but the manual does not recommend it for good reasons.
> The manual also mentions that the Repast-method for stepping agents works
> like the sim.engine.MethodStep-method from Mason, but I recently looked
> into the current version of Repast Simphony 2.5 and Repast uses costume
> annotations @ScheduledMethod(start = 1, interval = 1), to add methods to
> the schedule, which seems to me that this is not a violation of Java
> contracts (as the mason manual claims on page 108). Is the mason manual
> maybe outdated or am I not correctly understanding the critique about the
> way Repast schedules methods?


Ph.D student in Computer Science, George Mason University
Web Director, Journal of Mason Graduate Research