These are chat archives for jdubray/sam

4th
Dec 2018
Dannel Albert
@nerdo
Dec 04 2018 05:17
So, I just stumbled my way through TDD'ing my first super simple use of the SAM pattern lol. I stumbled because the pattern felt a bit awkward to use for the first time. I tried to follow some of the samples and finally ended up getting it working, and I've made some observations.
It makes sense that, for example, in the TODOSAM example simple functions are used for everything and the "pieces" are glued together with simple objects like actions, state, model, and where different pieces need each other, they're passed in as function arguments... more or less.
Dannel Albert
@nerdo
Dec 04 2018 05:22
I ended up making some ES6 classes to represent the view, state, model, and actions and keeping a reference to each dependency so I didn't have to pass them around. Is there any good reason to retain the ability to pass those pieces as arguments (e.g. have my actions class just reference this.model instead of passing model to each action)?
Dannel Albert
@nerdo
Dec 04 2018 05:35
FYI this is what I ended up with https://github.com/nerdo/sam-tdd
It's just the dumb, super-simple counter example
Dannel Albert
@nerdo
Dec 04 2018 21:05
I think I just butchered all the names of things lol. Having State not really be what most would expect it to be drove me nuts, making it more difficult than it should be to reason about
For now I'm calling it Supervisor so it still fits the SAM acronym :P but doesn't confuse me like State does