These are chat archives for jdubray/sam

7th
Oct 2016
Jean-Jacques Dubray
@jdubray
Oct 07 2016 06:00
I am giving a short intro on SAM/ng2 next Saturday (10/15) https://twitter.com/ladyleet/status/784200325473398785
dnson
@imnutz
Oct 07 2016 14:34
@jdubray this lib https://github.com/tj/co + javascript generator work just fine for your requirement
Edward Mulraney
@edmulraney
Oct 07 2016 14:39
@imnutz he won't be able to yield the function tho, its express stuff calling the function
Jean-Jacques Dubray
@jdubray
Oct 07 2016 14:45
@edmulraney thank you, I'll give it a try.
Fred Daoud
@foxdonut
Oct 07 2016 14:50
@jdubray that's interesting. looks like you are having success combining SAM with ng2. I am surprised, though, because I would think that trying to use SAM would go "against the grain" of ng2. Was it smooth to make SAM "fit in" with ng2? And, along the same lines, another question I have is, what does ng2 bring to facilitate using SAM?
devin ivy
@devinivy
Oct 07 2016 15:03
@imnutz @jdubray i can't imagine http-proxy supporting generators in that filter but not callbacks or promises.
Edward Mulraney
@edmulraney
Oct 07 2016 15:18
@devinivy exactly
Jean-Jacques Dubray
@jdubray
Oct 07 2016 15:41
@foxdonut 100% smooth, I work with a F50 customer and SAM/ng2/node.js has become their standard stack. It's actually very easy, even with templates (one-way-databinding). It's a real value add to ng2 because you are no longer dealing with parent / child relationships. An event is fired, you execute the SAM loop and the state publishes the resulting state to the components. This is much better than the horrible coupling of the business logic inside components and inter-component notifications. Ng2 brings nothing to help implement SAM, but it does not make it harder though. One way databinding is not that bad. You can also dynamically compile a template so you can have a true V = f(M) if you want. Angular-CLI makes it almost manageable to deal with ng2 as well. I also like TypeScript more than I would have ever imagined.
Here is the code sample I wrote: https://github.com/jdubray/sam-samples/tree/master/angular2-admin-master/src/app
It's not translated to the latest 2.0.0 code base, but SAM is not using much of angular, so it should be strictly the same code running in angular2, if only I could get the new version of that template running ... (sigh)
@devinivy @edmulraney did you mean to say " i CAN imagine http-proxy supporting generators in that filter but not callbacks or promises"
@foxdonut I have another sample available, with dynamic templates, but here I am not sure if it would work similarly with 2.0.0 https://bitbucket.org/jdubray/crud-sample-sam-angular2
Fred Daoud
@foxdonut
Oct 07 2016 15:50
@jdubray cool, that is what I suspected. Namely, what you said: "[SAM is] a real value add to ng2" and "Ng2 brings nothing to help implement SAM". I guess it's not a terrible choice, but personally I think ng2 brings in way too much complexity for not much value add, I would choose something else to implement SAM. I also agree with you that TypeScript is pretty nice, I am using it for my next Meiosis example (hapi.js + react + material-ui)
Edward Mulraney
@edmulraney
Oct 07 2016 15:52
@jdubray no - if you cant use a promise/callback you wont be able to use a generator
i just checked their source to confirm
Jean-Jacques Dubray
@jdubray
Oct 07 2016 15:53
I see, thanks
@foxdonut yes, the complexity is definitely there and the &@*#$&(@# "Release Candidate" was such a kick in the stomach for the ecosystem, but again, once you step into ng2 it appears less complex than you would have thought. We are building quite a substantial project right now and there is no hiccup, it's very linear. When I compare it to React, it feels less opinionated. I had more trouble wire SAM into React than in Angular.
devin ivy
@devinivy
Oct 07 2016 16:11
@jdubray are you using sam with observables as wiring between state and view?
dnson
@imnutz
Oct 07 2016 16:16
@edmulraney @devinivy ya, you are right. I didn't notice that http-proxy : )
Fred Daoud
@foxdonut
Oct 07 2016 17:02
@jdubray that is all quite interesting, thanks for sharing your experience.
Jean-Jacques Dubray
@jdubray
Oct 07 2016 18:17
@foxdonut one more thing, angular-cli is your best friend!
Fred Daoud
@foxdonut
Oct 07 2016 20:57
@jdubray :)
Edward Mulraney
@edmulraney
Oct 07 2016 22:55
@jdubray how was SAM easier to wire into Angular than React? React would just be a view layer as a function of the model. Angular has a far more complex buy-in?