These are chat archives for jdubray/sam

29th
Mar 2016
Jean-Jacques Dubray
@jdubray
Mar 29 2016 01:39
@Mystagogue you are free to use REST or ignore it altogether (which is my case). REST is just one kind of wiring, it does not change the underlying semantics of the pattern.
Jean-Jacques Dubray
@jdubray
Mar 29 2016 02:13
@imnutz has created a SAM sample using a template (ex-machina) and snabbdom:
https://github.com/imnutz/sam-exmachina
weepy
@weepy
Mar 29 2016 20:02
so I'm just considering how to build an semi complex app with SAM
it consists of a number of components C
that sit in a container object we'll call the Page
so we want the components to not have any knowledge about the other components - and they shouldn't know in particular about their "parent" - the Page
what's a sensible model to wire all this together ?
the view of each component needs to dispatch and action, and that action needs to reference the original component so that the Page knows what to do
I guess this idea must be covered in Flux/Redux since it has a similar archtecture
devin ivy
@devinivy
Mar 29 2016 20:40
what is the most barebones description of the difference between SAM and the flux variants?
it seems like flux is a good reference-point, and also that SAM is a special case of flux, but i can't definitively put my finger on the additions that SAM makes.
Jean-Jacques Dubray
@jdubray
Mar 29 2016 20:43
@devinivy there is a comparison between redux and SAM here: http://sam.js.org/#react
devin ivy
@devinivy
Mar 29 2016 20:46
@jdubray thank you. i enjoy reading your articles and i will be exploring SAM, so i'll probably be back with more questions!
weepy
@weepy
Mar 29 2016 20:52
@jdubray so i noticed rocket-ng in your sam-samples. I'd love to see the equivalent in SAM .
Jean-Jacques Dubray
@jdubray
Mar 29 2016 20:53
@weepy that sample is SAM based, it was built by @brusand
yes please, thank you! The factoring is very different, even though on the surface it looks similar.
weepy
@weepy
Mar 29 2016 20:54
I see - good to see the flexibility - tho I'm not fluent in Angular - so all greek to me :)
Jean-Jacques Dubray
@jdubray
Mar 29 2016 20:54
me too...
weepy
@weepy
Mar 29 2016 20:55
is it a good pattern than every component and subcomponent directly accesses the global actions to perform mutations ?
Jean-Jacques Dubray
@jdubray
Mar 29 2016 20:55
Did you take a look at this SB Admin template implementation?
It also supports localization
weepy
@weepy
Mar 29 2016 20:56
sure - but really it's just gluing a bunch of HTML together.
It's not like nested components
Jean-Jacques Dubray
@jdubray
Mar 29 2016 20:56
it's not much different? not sure I see what you have in mind.
weepy
@weepy
Mar 29 2016 20:58
so i have a page 1 with component B in it
and also page 2 with component A that has a subcomponent B in it
these components need to be reactive - so they need to dispatch actions
Jean-Jacques Dubray
@jdubray
Mar 29 2016 21:00
What is your topology? are the actions on the server?
weepy
@weepy
Mar 29 2016 21:01
say this is all client side
and also say I want to test the component B without any pages or parent containers
i guess that each action that it dispatches needs to have a reference to itself so that whoever runs it knows where the model data and view is ?
Jean-Jacques Dubray
@jdubray
Mar 29 2016 21:03
Did you take a look at the TODOMVC challenge implementation? https://github.com/jdubray/sam-samples/blob/master/todomvc-app/js/app.js
weepy
@weepy
Mar 29 2016 21:03
will do
Jean-Jacques Dubray
@jdubray
Mar 29 2016 21:04
Here I show how to use "intents" to wire generic components to specific actions of your app
weepy
@weepy
Mar 29 2016 21:04
ah ok
/looking
Jean-Jacques Dubray
@jdubray
Mar 29 2016 21:04
these components can then be reused across apps without worrying about that wiring
weepy
@weepy
Mar 29 2016 21:04
sounds perfect!
Jean-Jacques Dubray
@jdubray
Mar 29 2016 21:05
great, let me know if you have any question.
more than happy to help
weepy
@weepy
Mar 29 2016 21:05
ok will do :D