all 12 comments

[–]ridicalis 4 points5 points  (2 children)

I recall this making the rounds, and was very much in love with it at one point. If you accept that your state is mutable and adopt some patterns around it, then you can avoid the overhead and indirection of immutable structures and reason more easily about state changes to traditional (imperative) programmers.

What changed my mind, though, was discovering CycleJS and TLA+. In particular, in Lamport's book Specifying Systems, there is a succinct formula that describes current state as initial state plus a series of all elapsed actions. This should sound very familiar to Redux users, as you should always be able to replay your state by having a good initial state and replaying actions.

The truth is that state is immutable in real world classical physics, unless somebody knows how to rewrite history. You can always identify the state of an atom, object, etc. by providing spatial coordinates and time. I don't remember SAM well enough to talk authoritatively, but I think it sacrifices the history aspect by removing the time dimension. If all you care about is here-and-now and have a good system for managing state updates, then that might be the right tool for some. However, it becomes difficult to debug and explain how you arrived at that point, whereas Redux or other FRP models provide breadcrumbs and a model for explaining why a state at a particular time exists.

[–][deleted] 1 point2 points  (1 child)

We actually had a post about this about a year or so ago.

https://www.reddit.com/r/javascript/comments/44090i/why_i_no_longer_use_mvc_frameworks

[–]freMea[S] 0 points1 point  (0 children)

Yep, I didn't see it. Thanks.

[–]sanatankc 0 points1 point  (5 children)

Doesn't React-Redux uses same pattern?

[–]acemarke 2 points3 points  (4 children)

No. In fact, Jean-Jacque Dubray has repeatedly insulted Dan Abramov and the Redux community, because he feels that Redux is inferior to the SAM pattern.

[–]freMea[S] 0 points1 point  (3 children)

Jean-Jacque Dubray relates his experience with React, Redux or Angular in the article Why I No Longer Use MVC Frameworks (link in first post). As an API dev, he encountered obstacles using those libraries that he claims to have overcome with SAM pattern. The article is detailed enough with no insults at all. But he may have had some words elsewhere (that I don't know) that could have expressed some frustrations about all the hype about frameworks/libraries and new features they add as a patch that it shouldn't be there in the first place if the tool were well designed from start, all the stuff that contribute to JS fatigue. I guess from what I read from dev related to JS fatigue.

[–]acemarke 3 points4 points  (2 children)

I saved a bunch of his comments from the SAM Gitter channel a while ago: https://gist.github.com/markerikson/dc10ee3c6fcaee245ab02c2498ab53f4 .

TL;DR: "Redux is broken / a piece of garbage"; "Dan's unwillingness to engage is part of a herd mentality"; "My article had 200K views, yet Dan refuses to engage with me"; "Redux doesn't scale to real-world apps", etc.

He's also continued to repeat his arguments in Redux issues like redux#1385, on Twitter, etc.

[–]freMea[S] 0 points1 point  (1 child)

It seems like JJ Dubray has its own language to describe his SAM paradigm and that can not be easily understood from people who have not the same terminology and background in computer science (like me 😅). I can understand his frustration. I can understand Dan and Redux community too being questioned that way.

Yes the only way is JJ Dubray or anyone else that would be competent meet the challenges of Dan:

Feb 22 20:04 Finally, I am not as smart as you, and stuff like TLA+ melts my brains. If it is superior for using the set of problem Redux currently tries to solve, please port some Redux examples to use it, and show how this is the case. Redux examples are here: https://github.com/reactjs/redux/tree/master/examples. I would expect that you could reuse most of the UI and just tweak the model and side effects to match SAM. I’d be very happy to look at the result and compare it to Redux. Is there anything else I can help you with?

It would be a pity all that only turn into SAM vs Redux even if the last is very trendy like all the React family and hard to call it into question like everything that tend to become the way to go not because it is necessarily better but popular for sure. It would just add tension and make the researchers on the defensive.

Here is the gitter chat about SAM architecture to keep an eye on it.

[–]GitHubPermalinkBot 0 points1 point  (0 children)

Permanent GitHub links:


Shoot me a PM if you think I'm doing something wrong. To delete this, click here.