These are chat archives for jdubray/sam
... but the State-Action behavior of state machines will make the code impossible to write. SAM suggests a new (heretic) behavior, the State-Action-Model behavior... Then each part of your code can reason cleanly about their own role.
Thanks for pointing it out again, that is what I missed.
@jdubray ... I will also refactor my initial decision to try to orchestrate complex queries with NAP which was also a very stupid decision. I just wanted to do like the Redux/Elm guys, which I believe people start seeing how broken that is
Do you mean setting
inProgress=true in model, and doing an API call as automatic action (NAP)?
callAPI? Wouldn't that mean that inside a SAM SAFE container, you would block any other action, while this is in progress? Otherwise, another proposal would cause this to be stale and rejected.
why it's better than just have a method on model? e.g. model.incrementBy() ...
If you do not do this, you have less coupling between actions and model. Actions can then be reusable across models. Increment by is a "harder" case, where you have to give a "hint" to the model, that a value should be incremented. There is no way to avoid that, I guess.
So an increment value could then be used on different models. Each model could do its mutations differently, interpret the proposed value differently.