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 Switch mode

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: Redirecting to Google Groups

Last Post!

jdubray

jdubray

Well at some point you have to mutate something, making the application state immutable is what buy you nothing in terms of managing mutability. Let’s compare:

var m = new Model();
m.accept(proposal).then(access)

with:
access(m = accept(m, proposal))

what’s the difference? a big malloc?

If X is a problem f(X) is rarely a solution, nor X$, not to mention, new X(). You probably need to dig a bit deeper than putting a big function box on some bad code to make it behave properly.

If you spend some time looking at TLA+ / Paxos and make an attempt to make mutation a first class citizen of your programming model, perhaps you’ll understand what I mean, otherwise, it looks like we’ll have to agree to disagree.

That being said, and quite strangely to be frank, Erik never talks about TLA+… I saw him mentioning it once in one of his talks telling the audience that he’ll have to learn about it, but he didn’t elaborate in any way.

Where Next?

Trending in Wikis Top

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement