These are chat archives for jdubray/sam

15th
Jul 2016
Edward Mulraney
@edmulraney
Jul 15 2016 08:16
@chiwoojo I've built the exact same thing! :)
Using webpack tho
I'm trying to finish other examples before I show it
Edward Mulraney
@edmulraney
Jul 15 2016 08:27
So far I have the:
  • the rectangles example, but with the options of dynamically generating new surfaces to draw rectangles on.
  • basic router/navigation
  • simple/dumb components
    Next I'm going to add a rich form example, and a dynamic/interactive (higher order) component
@chiwoojo also you mentioned difficulty with webpack - this projeect was announced yesterday that you might find interesting: https://github.com/easy-webpack/core
I've not used it but it looks promising
it's by the guys behind aurelia
Vincent Jo
@chiwoojo
Jul 15 2016 12:38
I'm interested in seeing those examples :+1: I would like seeing the router example the most, I remember looking up how one might do that..and spoke to JJ briefly about it. Are you using something called pushstates history or something like that?
I looked at the easy webpack but I'm still gonna use grunt-browserify because it took me 1/3 less time to configure and find information about how to make it work vs webpack; though if I'm needing missing features I will get the webpack and the idea of composable configuration is great :) I like that there are so many ideas on composition now
Vincent Jo
@chiwoojo
Jul 15 2016 15:03
@edmulraney can you share your webpack.config by anychance? currently having live reloading issues with grunt..
Edward Mulraney
@edmulraney
Jul 15 2016 16:37
yeah sure
its very basic, just does transpilation and bundle
module.exports = {
  entry: "./entry.js",
  output: {
      path: __dirname,
      filename: "bundle.js"
  },
  module: {
   loaders: [
     {
       test: /\.js$/,
       exclude: /node_modules/,
       loader: "babel-loader",
       query: {
         presets: ["es2015", "stage-0"]
       }
     }
   ]
 }
}
Edward Mulraney
@edmulraney
Jul 15 2016 16:46
@chiwoojo
Log-of-e
@Log-of-e
Jul 15 2016 17:14
anymore examples or explanations explaining assignment vs mutation. Or better yet, when to use either?
Jean-Jacques Dubray
@jdubray
Jul 15 2016 17:17
@Log-of-e I was just trying to provide some perspective as to what was different about SAM. When you look at Elm code for instance, you can see that it is using "assignment" (counter = counter + 1)
blob
All that SAM is saying is that you should divide this big red box in three buckets:
  • actions/proposers
  • model/acceptor(s)
  • state/learner(s)
It does not seem like much, but it makes your code a lot cleaner and solves a lot of questions that otherwise quickly become spaghetti code otherwise
Log-of-e
@Log-of-e
Jul 15 2016 17:19
ok, I have also been reading - http://sam.js.org/#sm
thanks
Jean-Jacques Dubray
@jdubray
Jul 15 2016 17:20
let me know if you have any other question
If you come from a state machine background, it's also important to understand the differences with standard state machine semantics
Otherwise SAM does not require to use state machine semantics, if-then-else work fine. In some cases, though, it might be easier to reason in terms of states (as in state machine states).
Vincent Jo
@chiwoojo
Jul 15 2016 21:04
@edmulraney thanks