These are chat archives for jdubray/sam

15th
Apr 2016
Jean-Jacques Dubray
@jdubray
Apr 15 2016 00:08
Actions play the role of mini adapters between the user intent and the model. They truly know what value the model should have.
They really tell the model what value it should take, but they do not have the scope of the business logic to enforce it
This is really about factoring your business logic
Similarly the model should not know much about the why these values are proposed (intent and action)
I feel this is a very healthy factoring of the business logic
Many actions could lead to the same dataset being proposed or overlapping datasets.
But all this is a matter of preference, and cannot be generalized, there will be cases where the proposal has to convey the intent of the user, there is just no other way around.
Jean-Jacques Dubray
@jdubray
Apr 15 2016 00:14
This is true of collection (e.g. add a todo), everyone would prefer proposing to add a todo rather than an entire new collection.
David Fall
@509dave16
Apr 15 2016 01:19
@jdubray Thanks the feedback! Just wanted to be clear on what the Action should know about the Model, and you nailed it.
Jean-Jacques Dubray
@jdubray
Apr 15 2016 01:25
Another precision, the actions should never need to do something like model.getState(), they should get all their data from the user intent and enrichment API calls.
Actions will apply validation rules from the application's perspective (which may be more restrictive than the model would allow) while the model will apply integrity validation rules, which scope tend to be far larger than the action should know about.
What I just explained is the main reason why I tend to be very critical of Redux because I feel the Reducer creates an unhealthy coupling between the actions and the model, for no other reason that they are trying to apply reactive programming to the letter.
State needs to eventually mutate, there is just no way around it... so you might as well handle that mutation in the cleanest way possible considering intents, validation, enrichment, persistence... There is just no reason to add artificial constraints.
Jean-Jacques Dubray
@jdubray
Apr 15 2016 01:31
SAM pushes the decision to mutate as far as it can in the business logic (beyond the action) but not further.
devin ivy
@devinivy
Apr 15 2016 03:51
@jdubray the existence of a (reducer) function (action, state_now) --> state_next itself is the coupling you're talking about?
Jean-Jacques Dubray
@jdubray
Apr 15 2016 03:52
yes, itcouples proposers with acceptor(s)
from an operating model you could have different teams writing application/channel specific actions
devin ivy
@devinivy
Apr 15 2016 03:54
i think i will read a little bit about paxos to have better intuition for that way of thinking about things
Jean-Jacques Dubray
@jdubray
Apr 15 2016 03:54
the reducers forces a single team to be responsible for writing that ball of mud