These are chat archives for jdubray/sam

29th
Jul 2017
Jean-Jacques Dubray
@jdubray
Jul 29 2017 00:50
yes, that's kind of the idea, you can use them when there is a real need for it, and ignore all the other states. One category that's really important that you cannot even model with classical state machines are Safety Conditions. In other words you just mutated the model and somehow you landed in a state that's forbidden (that's a bug) but before the rest of the universe gets to see the new state representation you can catch it and prevent any further damage. That's really powerful.
Janne Siera
@jannesiera
Jul 29 2017 19:00
I've tried looking at some sample code
but I'm not really seeing any good examples of the "Intent" way of proposing to the model
part of that might be my inability to parse Angular code
which samples show best latest-and-greatest SAM implementations with intents?
Jean-Jacques Dubray
@jdubray
Jul 29 2017 19:40
This is my blueprint for all projects (ES6) https://github.com/jdubray/startbootstrap-clean-blog. Angular is funny, it has all this ceremony that brings pretty much no value and Webpack can't even deal with it.
intents are just a simple level of indirection between event and actions.
Jean-Jacques Dubray
@jdubray
Jul 29 2017 19:46
It's more logical than practical, theoretically the user generates an event (click) with an intent, the intent can be wired to an action enabling the view component to be further decoupled from the action. It's pretty rare that you would need that level of decoupling. It would be useful for people producing libraries of view components. They wold not have coupling to actions.
You see this kind of concept with Amazon's Alexa where the event is a user utterance which is translated into and intent which is wired in your code to a handler.
Jean-Jacques Dubray
@jdubray
Jul 29 2017 19:51
@jannesiera The blog sample has an intent implementation, as you can see that's pretty crude: https://github.com/jdubray/sam-samples/blob/master/crud-blog-lambda/actions.js
Janne Siera
@jannesiera
Jul 29 2017 20:20
@jdubray and where do I see an example for a 'modern' increment counter example? As to prevent the concurrency issues?
Daniel Neveux
@dagatsoin
Jul 29 2017 20:24
The concurrency happening while the blog API is still pending.
Slađan Ristić
@sladiri
Jul 29 2017 22:13
@jannesiera You could present the delta, and the model would increment by that value (or by one). That way there would be no concurrency issue. While on one hand this is a dirty" SAM proposal, on the other hand it is the cleanest way to deal with concurrency, I think, apart from using a global lock or something.