renatoathaydes / actors

Actor Model library for Dart.
BSD 2-Clause "Simplified" License
47 stars 4 forks source link

feedback #12

Closed bsutton closed 2 years ago

bsutton commented 2 years ago

Thanks for the project.

Just a few suggestions.

1) documentation improvements.

Can you document what occurs with an ActorGroup when you send a message but all actors in the group are busy? I"m guessing the send will wait for an available actor but it would be good to see this documented.

2) LocalMessanger would be better named LocalActor or ActorLocal as it would be easier to find and provide naming consistency with the other Actors.

3) The ActorGroup on the example page should show ow to set RoundRobin/MultiHandler

4) Where a method takes generics you should document what they are.

ActorGroup<M, A> wasn't particularly obvious.

I'm guessing 'A' is for answer? I'm more used to seeing 'R' for result.

5) The terminology of 'Messages' seemed odd and it feels like it might have originated in your original use case rather than being more generic terminology.

Actors essentially run a computation on some data.

Given the 'Actor' analogy 'perform' might be better than 'send' as it fits nicely with the terminology and is close to the concept of running a computation.

I'm think about terms like 'stage' so

var stage = ActorGroup(); stage.perform()

cast would be a better fit but the word cast might be too overloaded.

var cast = Actor(); cast.perform();

ensemble

troupe = ActorLocal(); troupe.perform();

renatoathaydes commented 2 years ago

Hi, Thanks for the feedback.

Let me try to address your points:

  1. I will try to improve the docs.
  2. LocalMessenger is not an actor, it's a Messenger because Actors are a concept where their internal state is completely isolated (see the actor model theory) which can't be the case for local messengers.
  3. I will add an example.
  4. I will document that better. The actor model talks about messages and answers, not results (which are easily confused with error handling abstractions, which is not applicable).
  5. Messages are the terminology used in the actor model (see message passing). Actors communicate by sending each other messages.
bsutton commented 2 years ago

Messages are the terminology used in the actor model (see message passing). Actors communicate by sending each other messages.

Except as far as I can tell that's not what your library does.

You could argue that you send a message when starting an actor but I don't see any method for actors to communicate.

I would argue that your choice of terminology is a mismatch to what you have implemented with the result that you have made your library difficult to understand.

renatoathaydes commented 2 years ago

You could argue that you send a message when starting an actor but I don't see any method for actors to communicate.

I disagree. Calling an actor's method exactly the same as sending it a message. My implementation is based on Pony actors which work as similar as possible in this library, given Dart's limitations.

EDIT: how is this not sending a message to the actor???

actor.send(myMessage);

Please, let's keep the discussion about specific things. If you don't like the philosophy of the library, use another library, this is not something I am willing to change.