These are chat archives for jdubray/sam

14th
Jun 2016
devin ivy
@devinivy
Jun 14 2016 00:15
it is possible to use the SAM pattern while leveraging redux.
Jean-Jacques Dubray
@jdubray
Jun 14 2016 01:04
Yes, Redux is not incompatible at all with SAM, it is just unfortunate that what Dan calls actions is really just events. It would be better to have a single definition of what an action actually is (a function) and clearly decouple proposer from acceptors. Originally I felt that Dan would be open to that, but he sees the current approach (event+reducer) as key to the kinds of tools he is building.
After that the next question is "effects", Dan wants a pure functional approach which I believe the industry will walk away from as it brings too much complexity for no value. Frameworks like Cerebral or MobX have already shown just that. Not to mention how inefficient it is to have an immutable application state (and hence have to copy the entire state to process each event).
devin ivy
@devinivy
Jun 14 2016 01:09
curious– how has cerebral shown that? does cerebral demonstrate the problem or the solution?
Jean-Jacques Dubray
@jdubray
Jun 14 2016 01:09

@edmulraney

you can make components plain javascript functions

yes, I believe that's where the industry will go.

devin ivy
@devinivy
Jun 14 2016 01:09
you said you were speaking with the creator of cerebral a little while ago. i enjoy that feller's blog!
Jean-Jacques Dubray
@jdubray
Jun 14 2016 01:09
They have the solution, but they speak about the problem of not being scalable, that's kind of well know by now.
Yes, he's quite an amazing guy.

This is what Cerebral brings to the model:

  1. Immutable

    • Time travel debugging
    • Recording
    • Undo
    • Hydrate/dehydrate state
  2. Mutable

    • Relational data (allowing object referencing inside the state tree)
    • Large datasets (because mutable is faster)
You can choose between two types of state tree:
  1. Immutable (Using baobab)
  2. Mutable (Own implementation - https://github.com/cerebral/state-tree)
devin ivy
@devinivy
Jun 14 2016 01:19
@jdubray wow i think this is exactly what i've been looking for!
polymer is going to love state-tree...
Jean-Jacques Dubray
@jdubray
Jun 14 2016 01:40
Yes, I am very impressed with the latest version of Cerebral
and Christian's pragmatism
Jean-Jacques Dubray
@jdubray
Jun 14 2016 02:07
@devinivy this is the Cerebral presentation I referenced earlier: https://www.youtube.com/watch?v=xN7yg95AwXU
weepy
@weepy
Jun 14 2016 07:11
@jdubray "the problem of not being scalable" -- what is this problem with cerebral?
Jean-Jacques Dubray
@jdubray
Jun 14 2016 08:09
no problem, they are stateful. You don't need to copy the state tree each time you process an event.
Edward Mulraney
@edmulraney
Jun 14 2016 10:08
@jdubray the author of cerebral says he handles accidental double submissions the same we I described the other day:
" In this scenario I would set an "isSubmitting" state as part of an action in the signal. That would be used to disable the submit button in the form, avoiding any more clicks as the form is submitting." reactjs/redux#343
weepy
@weepy
Jun 14 2016 10:14
can cerebral handle the "Propose/Accept" phase of PAL/SAM ?
Jean-Jacques Dubray
@jdubray
Jun 14 2016 11:07
if you use allowed actions in SAFE you don't need anything specific in the model. you have to do everything possible to avoid managing these microstate machines in the model.
I actually can't understand why people would think it is easier to manage subscriptions or explicit states versus allowed actions.
@weepy that"s what I want to talk about with Christian, I don't see why not.