These are chat archives for jdubray/sam

5th
Jun 2017
Viktor Yakubiv
@viktor-yakubiv
Jun 05 2017 12:37
@jdubray, no, I'll not. I'm trying looking for solution in my own. It's kind of 'pet' research.
Viktor Yakubiv
@viktor-yakubiv
Jun 05 2017 12:49

I have seen in your example of blog an object called data, where all server data responses are stored.

In my vision, model is a full-functional object which stores all data and also can validate and manage it. Everything else is job of controllers. Sorry, it's MVC.

But here data is an external object. In your example it's pure. But also it can be functional, and some part of the model, such as validation can be moved to external data object. It's kind of local database management system.

Is it true vision of your example, or SAM generally?

Jean-Jacques Dubray
@jdubray
Jun 05 2017 12:59

@viktor-yakubiv as I said earlier, SAM answers three fundamental questions have have been overlooked:

  • are all assignments mutation, if not what is a mutation?
  • which part of your code can mutate state (e.g. can actions/controllers mutate state?), if not, how does mutation get initiated?
  • is the unit of programming a line of code or do we need to define what is a programming step with precision?

if you are not interested in these questions, then SAM is not for you. SAM comes from the semantics of TLA+. Someone can tell me that I was wrong in interpreting TLA+ and we can discuss what it the best way to align with TLA+, but I didn't create SAM waking up one morning and said why don't we try that? SAM has nothing to do with Functional Programming, Object Oriented Programming, Reactive Programming, SAM Is not a language, it is a pattern to help you factor your code.
The model in SAM does indeed behaves like a database because it centralizes all mutations.

Viktor Yakubiv
@viktor-yakubiv
Jun 05 2017 13:01
So SAM cannot be decentralized or nested?
Jean-Jacques Dubray
@jdubray
Jun 05 2017 13:02
Yes, of course, parent/child relationships between SAM instances work very well.
Viktor Yakubiv
@viktor-yakubiv
Jun 05 2017 13:05
Thank you.
Jean-Jacques Dubray
@jdubray
Jun 05 2017 13:25
@viktor-yakubiv here is an example of parent/child implementation: https://github.com/jdubray/sam-samples/tree/master/react-child-instance