These are chat archives for jdubray/sam

24th
Apr 2018
Hamza OuaƔad
@jshrt
Apr 24 2018 00:06
@jdubray I most certainly agree about the part where mutations ought to be completely isolated from anything else
I just fail to spot how Redux alongside React does not encourage that. (let's imagine that React only proposed stateless components for the sake of the argument)
Hamza OuaƔad
@jshrt
Apr 24 2018 00:12
So state mutation is also decoupled from the view, We would have some View that calls for an action through on an event, and the action itself would "propose" the changes to the state via a the dispatch of the store, which "accepts" the mutation inside of the reducer, and the state is mapped to the views props, which could be a bit expressed like: V = Mapper(store.dispatch(action(event))
Now I'd agree with you when in React they start throwing a bunch of stateful components to maintain some sort of internal state just to be able to do: then(NAP) in their own way
Well now that I think of it, It's hard to mess something when you are using the SAM pattern, while you could easily mess around with others that do not enforce such rigour
Jean-Jacques Dubray
@jdubray
Apr 24 2018 01:36
I never said you cannot implement SAM with React/Redux, from what I understand some people use SAM with React and also Redux.
I am just arguing that the granularity and the general recommendations around Redux are too coarse to isolate mutations. A reducer typically spans a SAM action, mutation and state representation, not to mention NAP. All this code is conveniently wrapped in a pure function. That's the only point I am trying to make.
SAM is very gentle when it comes to code structure, I never felt constrained by the pattern, quite the opposite, each time I tried to take a shortcut, I ended up paying the price. In all honesty, I have never been in the situation where I felt, "why did I use this pattern".
I come from a "stateful" background (B2B, BPM, EAI). I also have quite a bit of front-end experience (Mobile, Web, Thick Clients). Managing state has always a problem until I stumbled onto SAM. I am sure it can be perfected, but from my perspective, it has given me a reliable coding style without much constraints.
Janne Siera
@jannesiera
Apr 24 2018 13:13
@jdubray don't you experience a lot of boilerplate as a hurdle?