SAM-Redux (Live version)
This repo is an attempt to use Redux for SAM architecture while keeping time-travel possible. On the side, it introduces a way to handle actions with timeouts.
Also, it uses a very simple React component for the View.
This repo intends to extend the discussion about SAM happening in Gitter.
Clone the repo and run npm run watch
to live edit the source or npm run build
to build into /dist
.
The View present()
s values to the Model, which decides whether to accept them.
Accepting means mutating the store with the received value.
Redux is used for this mutation, allowing for Time-travel and Hot Reloading of the reducers.
Runs after the Model has mutated (or not) and may dispatch automatic actions based on the State.
E.g. if (countingDown) { decreaseCounter() }
(pseudocode)
In SAM, the State is a pure function of the Model (i.e. Store), and like React the View is a pure function of the State (that's why there is no V in SAM: State -> View).
SAM is State-Action-Model. It's a software architecture propsed by Jean-Jacques Dubray in his (in)famous article Why I no longer use MVC Frameworks / Part 2 and Introducing the SAM pattern as an alternative to MVC.
Dubray states that SAM is based on TLA+ concepts pioneered by Dr. Lamport.