uranther

uranther

The SAM (State - Action - Model) pattern - General Discussion, Blog Posts, Wiki

SAM is a new reactive/functional pattern that simplifies Front-End architectures by clearly separating the business logic from the view and, in particular, strictly decoupling back-end APIs from the Front-End. SAM is technology independent and as such can be used to build Web Apps or Native Apps. It is also protocol independent and can be implemented over HTTP, WebSockets…

Creator: @jdubray
Gitter chat: https://gitter.im/jdubray/sam

SAM is a pattern that aims at replacing the MVC pattern. If you are already familiar with MVC, you should be able to make an easy transition to SAM.

There are two main differences between MVC and SAM. First, SAM is reactive, while MVC is generally implemented in an interactive way. Some attempts have been made at implementing it in a reactive way, however, SAM is not just a reactive implementation of MVC. Second, SAM introduces the concept of State as a mechanism to further decouple the View from the Model and treats the view merely as a “State Representation”.

Articles

Examples

  • sam-tic-tac-toe
  • SAM Lambda — SAM Lambda is a boiler plate project that implements the SAM pattern in AWS Lambda using DynamoDB to manage application/session state

Temporal logic of actions (TLA)

Articles

  • Temporal logic of actions (TLA) is a logic developed by Leslie Lamport, which combines temporal logic with a logic of actions. It is used to describe behaviours of concurrent systems.

  • TLA+

    … is a formal specification language developed by Leslie Lamport. It is used to design, model, document, and verify concurrent systems. TLA+ has been described as exhaustively-testable pseudocode and blueprints for software systems.

    TLA+ is based on the idea that the best way to describe things formally is with simple mathematics, and that a specification language should contain as little as possible beyond what is needed to write simple mathematics precisely. TLA+ is especially well suited for writing high-level specifications of concurrent and distributed systems.

  • Use of Formal Methods at Amazon Web Services

  • Why We Should Build Software Like We Build Houses

INDIRECT

Presentations

Academic Papers

See The Writings of Leslie Lamport for a full list of publications from this researcher.

“Programming languages provide no well-defined notion of a program step”

“State machines provide a framework for much of computer science. They
can be described and manipulated with ordinary, everyday mathematics”

Books

Related architectures

Most Liked

gregvaughn

gregvaughn

Interesting. This is the first time I heard it called SAM. I first heard about it as the Reactor model, or even “The Elm Architecture”

AstonJ

AstonJ

A post has been edited and two others removed. Please do not make the thread personal - stick to the topic of discussion and feel free to rebut any poor arguments or put your point across without making personal remarks. Thanks.

StefanHoutzager

StefanHoutzager

Because Dubray has some critique on elm and says that an alignment with SAM would make it stronger I posted a question in an elm discussiongroup: https://groups.google.com/forum/#!topic/elm-discuss/r8sA57H7HEw

jdubray

jdubray

What’s missing in modern frameworks like Elm is the notion of a “Step” you just cannot arbitrarily process events, that is the problem. SAM suggests that a “step” (in response to an event) is composed of three phases: propose, accept and learn. When Elm issues a series of tasks to run some effects, it misses the essence of state mutation.

SAM is based on TLA+ semantics which introduce a new way to look at state machines, a lot closer to the way we write every day code (as opposed to traditional semantics like tuples (S0,A,S1). TLA+ provides enough structure without the burden of traditional state machines.

Happy to continue the discussion if you’d like.

rvirding

rvirding

Creator of Erlang

Shouldn’t the model and the state be one? Which states you have and transitions between them is completely defined by the model so splitting them seems strange.

But I may have misinterpreted the meaning of state and model.

Robert

Where Next?

Popular in Wikis Top

axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
swelham
Introduction After some discussion with a few other members we thought it might be an idea to start a thread where we can post about libr...
New
Rich_Morin
I’d like to start a discussion of data serialization formats, in the context of Elixir. The rest of this note is a combination of persona...
New
AstonJ
Wonder if we can compile a list of learning resources, blog posts, talks, threads etc to help those who are just learning about Contexts....
New
ibgib
Popular Elixir Packages List of popular Atom.io Elixir Packages. These can be installed via atom’s package center or a command line with ...
New
shavit
To transcode the video there is FFMPEG. On Demand When a user uploads a video, the app renames and copy the file to a path, then call F...
New
BartOtten
A wiki for Doom Emacs Doom is a configuration framework for GNU Emacs. It focuses on performance and customizability. It can be a founda...
New
nicbet
Introduction Now that the language is picking up support and maturing nicely, I’d like to start a collection of common and recurring Elix...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New
blackode
Hi and Hello Every Elixirian. After Learning the Elixir basics, I struck then. I have no idea of how to put my Elixir Knowledge in pract...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New

We're in Beta

About us Mission Statement