DEV Community

Discussion on: Get to know the Actor Model

Collapse
 
theodesp profile image
Theofanis Despoudis

Sorry but this way of sending commands:

    Actor.send(address, ["incrementBy", { number: 2 }]);

looks ugly and does not offer any significant advantage in terms of readability and maintenability.

The main problem I see is that you have to retrieve the references to those objects you created before you send the command thus making the program more coupled. It gives too much control on who should receive the message.

What I would like to see is a general message dispatcher that any interested party can subscribe to action types. That way you have a more decoupled way of dealing with actions and effects. The sender won't have to know details.

Collapse
 
pinei profile image
Pinei

Another approach is to provide a message type (instead of an address) and implement a message routing mechanism. Multiple strategies can be used in this mechanism.