Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target mechanic uses bad design #16

Open
ErikBjare opened this issue Mar 1, 2016 · 1 comment
Open

Target mechanic uses bad design #16

ErikBjare opened this issue Mar 1, 2016 · 1 comment

Comments

@ErikBjare
Copy link
Member

Setting self.target in every agents __init__ is nasty, there was a discussion of moving it to the Agent base class but for some reason we didn't...

Why?

@ErikBjare
Copy link
Member Author

I talked to @vlthr and I think everyone agrees that the current system is a mess. I'd even go as far as to say that the current method for deciding the receiver of a message needs fixing. Notably the use of both the _bindings defaultdict in Dispatcher as well as the chain method which is a completely different way to dispatch messages.

As I've understood it from reading the current Dispatcher implementation:

  • bind binds a agent as a listener to the activity on a chosen selector (currently nothing more than the msg["type"]), which is essentially a pubsub channel which anybody can write to but which requires registration/subscription in order to read messages (messages are dispatched instantly, there is no dispatch history for each individual selector and they are removed from the queue as soon as they are processed).
  • chain makes messages flow through a series of agents, however it seems to destructively overwrite agent.target for all agents involved (see [line 41]), which is a bit worrying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant