These are chat archives for jdubray/sam

27th
Nov 2016
Edward Mulraney
@edmulraney
Nov 27 2016 13:36
what is the react/redux programming model problem ?

It would really help if someone could define a reference programming model we can all return to decide on guidance

@jdubray what do you mean when you say "reference programming model"? are you talking about what I suggested a few messages ago? a reference/specification independent of framework/library?

Jean-Jacques Dubray
@jdubray
Nov 27 2016 14:19

yes, one ought to be able to say the 4-5 fundamental concepts of React/Redux are:

  • action
  • reducer
  • store
  • component

and this is how they relate [...]

everything else has an IS-A relationship with these concepts. You can see for instance that ActionCreators and Actions don't have an IS-A relationship. So right there the 4 concepts I enumerated are not enough. The idea is to always be able to express a solution in terms of the reference programming model and then find local/use case driven optimizations.

A community need that kind of foundation.
Jean-Jacques Dubray
@jdubray
Nov 27 2016 15:06
Mattia Manzati has created a single-state-tree Modle for Mobx, and he introduces yet another concept named "action" (which is not)
const Box = createFactory({
    // props
    name: "",
    x: 0,
    y: 0,

    // computed prop
    get width() {
        return this.name.length * 15
    },

    // action
    move: action(function(dx, dy) {
        this.x += dx
        this.y += dy
    })
})
Edward Mulraney
@edmulraney
Nov 27 2016 15:07
why isn't that an action?
also @jdubray would you be interested in my project that im working on then? regarding using specification to define youre app rather than using a framework directly? or is this not really what you're interested in?
Jean-Jacques Dubray
@jdubray
Nov 27 2016 15:10
an action cannot manipulate the model, only the model can "update" the model via a proposal.
Edward Mulraney
@edmulraney
Nov 27 2016 15:10
by your/other's definition perhaps, but not by that author
Jean-Jacques Dubray
@jdubray
Nov 27 2016 15:11
if we can never agree on what an action is, say like what a function is, this is hopeless.
Please note, that I am not necessarily asking that people adopt my version of an action, I am simply noting that everyone and their brothers seem to come up with a different definition.
that's a problem
@edmulraney I am working on similar concepts right now, we could trade notes.
Edward Mulraney
@edmulraney
Nov 27 2016 15:13
i agree it would be good for the community to have a common understanding of an action
but if you take SAM to its extreme your basically saying never mutate state objects directly, simply provide an acceptor API that lets the state decide whether or not to apply a mutation, based on some input
i think projects like OM and Clojure do this
so in SAM you only have one action: propose(). everything else is just proposition-forming functions
Jean-Jacques Dubray
@jdubray
Nov 27 2016 15:17
Well, that would amount to letting arbitrary program snippets directly write data in a database file. the SAM pattern is very common if one cares to look
But even UML has it wrong: "In the Unified Modeling Language, an action is a named element that is the fundamental unit of executable functionality. The execution of an action represents some transformation or processing in the modeled system. "
Edward Mulraney
@edmulraney
Nov 27 2016 15:25
you could argue that the mutation is actually the real action. if i say i want to add a new user, would i say the action of adding a user is complete because ive asked for it? or would i say the action of adding a user is complete when my user is actually added to my list of users?
Jean-Jacques Dubray
@jdubray
Nov 27 2016 15:26
sure, it's not so much the "word" action that I care about, I just care that we have a common concept associated to that action, just like everyone understands what a function is. And yes, clearly mutation is related/part of that definition.
It's just not helpful when people arbitrarily name something an "action"
Edward Mulraney
@edmulraney
Nov 27 2016 15:26
agreed :)
Edward Mulraney
@edmulraney
Nov 27 2016 15:41
@jdubray did you look at the tom library i linked recently?
Jean-Jacques Dubray
@jdubray
Nov 27 2016 15:52
blob
See that's the part I don't understand: why the effects have to be initiated by the state/model.
What's the problem of having some side effects realized prior to the state?
Fred Daoud
@foxdonut
Nov 27 2016 19:44
So many problems go away when 1) you don't try to horseshoe side effects into an "action" object (à la redux), and 2) you restrict model mutation to a well-defined and clearly-controlled part of the reactive loop (SAM/model.present)
Jean-Jacques Dubray
@jdubray
Nov 27 2016 20:08
Yes, that seems so clear, I am not sure why it's so hard to have that discussion.