These are chat archives for jdubray/sam

22nd
Apr 2018
Jean-Jacques Dubray
@jdubray
Apr 22 2018 01:32
thank you!
Hamza Ouaghad
@jshrt
Apr 22 2018 04:51
Hey @jdubray Thank you for your response and clarifications, I think it might be worth adding such clarifications to the website, as I used to think of MVC as merely some derivative of SoC where implementation details differ per project, as I could have the view be a result of computing the model, or actually data-bind.
But apparently you precisely mean that such difference lie in data binding vs v = f(m)
Thanks!!
I suppose the best summary of SAM would be: V = State(Model.present(Action(event))).then(NAP)
Hamza Ouaghad
@jshrt
Apr 22 2018 05:03
Also, could you please expand on how connecting the view to events via a pure function does not work? I mean there are examples of how to use SAM with Redux, which seem to sort of delay the dispatch part to be run after that the present have been dealt with
Jean-Jacques Dubray
@jdubray
Apr 22 2018 12:41
@jshrt the paradigm shift that we need to embrace as an industry is that we cannot manipulate "state" anywhere in our code at any point in time. That is the problem. Mutations ought to be isolated and step-bound while everything else ought to be truly stateless (View, Actions, State Representation, NAP).
The decoupling between Action, Model/Mutation, and State Representation is very healthy, for the last 2.5 years I have used SAM, my code has had hardly any temporal defect, I was able to maintain large projects with constantly shifting (not just changing) requirements without major refactoring. I feel that none of that could have been achieved in any way with (basic) Redux and Reducers alone, because in essence Redux does not provide any boundaries in the Reducer. You are free to code as you always did. When you take a bunch of code and put a pure function wrapper around it, you achieved nothing.
SAM goes as far as providing an alternative to immutablity with the concept of proposals. Proposals give you a chance to get ready to mutate so that you can reason about the next state without having mutated anything. Let's compare that with a bunch of randomly distributed assignments inside a pure function...