These are chat archives for jdubray/sam

16th
Dec 2017
david kaye
@dfkaye_twitter
Dec 16 2017 01:19
bit by bit I think I'm getting the hang of it...
Jean-Jacques Dubray
@jdubray
Dec 16 2017 19:16
One more thing, in the State function you would compute all relevant property values of the application state. At that point the proposal has been processed and you can no longer access it. Here we simply compute the structural relations of the model (in a reactive way).
render(model) {

    // compute state representation
    let stateRepresentation = xyz(model)
    // render if no next action

    !state.nextAction(stateRepresentation)
      && view.render(stateRepresentation)
  },
the nextAction predicate would return false only when the nextAction is synchronous, in which case you need to skip the rendering.
When the next action is asynchronous, you may render, but that is your decision
Jean-Jacques Dubray
@jdubray
Dec 16 2017 19:23
It's really about clearly separating a number of concerns:
  • validation
  • enrichment
  • transformation
  • mutation
  • (state) computation
  • state representation from model property values
  • next action determination
  • view from the application logic
I believe that's a much more sensible way to write code. You can never get lost in your code.
Jean-Jacques Dubray
@jdubray
Dec 16 2017 19:30
Otherwise all these concerns would interfere
Jean-Jacques Dubray
@jdubray
Dec 16 2017 20:29
Not sure if you guys saw parceljs
david kaye
@dfkaye_twitter
Dec 16 2017 23:04
Saw parceljs - been everywhere I look this week.