An experiment at using Redux for SAM
JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src Major refactor Feb 24, 2016
.babelrc Initial commit 💥 Feb 23, 2016
.eslintrc Initial commit 💥 Feb 23, 2016
.gitignore Initial commit 💥 Feb 23, 2016 Major refactor Feb 24, 2016
package.json Working example Feb 23, 2016
webpack.config.js Add redux-devtools Feb 23, 2016

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.

How it works


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.

nap (Next Action Predicate)

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.