These are chat archives for jdubray/sam

3rd
Nov 2016
Zach Dahl
@schtauffen
Nov 03 2016 00:18
Jsync.on.start('my-id', fn) equates to: if (action.type === '@@jackalope/async/start' && action.data.id === 'my-id') { fn() }
does it still have the issues you speak of? (I'm not really sure what you mean by isolation/synchronization). on.start is not adding event listeners to anything it is simply a helper that does the logic as described ^
Jean-Jacques Dubray
@metapgmr_twitter
Nov 03 2016 00:19
I guess I am not understanding how this is wired. It this an event ("on") or is this a sync call if (cond) then...?
Zach Dahl
@schtauffen
Nov 03 2016 00:23

it is synchronous, Jsync.on.start('my-id', fn) === if (action.type === '@@jackalope/async/start' && action.data.id === 'my-id') { fn() }
https://github.com/schtauffen/jackalope/blob/master/async/async.js#L154-L170

I may have gone a little crazy with currying

Jean-Jacques Dubray
@jdubray
Nov 03 2016 00:29
I see... sorry it looks like an eventing mechanism. I'll have to study how you implement it. Looks interesting.
Rick Medina
@rickmed
Nov 03 2016 14:18
hello all! question: let's say I have some logic/feature like a drag and drop (its logic is contained in the actions and in nap), if then I want to remove that feature I would need to seek and remove the related logic in 2 parts (not considering if it has state related functions), whereas if I use something like rxjs or sagas, the whole logic is in one place, would you say that is a tradeoff vs sam?
Jean-Jacques Dubray
@jdubray
Nov 03 2016 14:22
well, it's not really a trade off, it's not too hard to keep related actions, model, and state (including nap logic) in one place and "wire" these elements at initialization time. I believe meiosis does just that. To illustrate the pattern it's a bit easier to show how it works in simple cases.
From a factoring perspective, you have to compare the factoring of Reducer/Sagas versus Model/State/Nap at face value. For instance Sagas break the principle of a single state tree. Is that desirable? is it going to cause problems when your code scales in complexity? Grouping and assembling elements of code together is not hard to do, breaking principles like "single state tree" is on a completely different level.
Rick Medina
@rickmed
Nov 03 2016 14:24
yes! I have no idea how that would look like
Jean-Jacques Dubray
@jdubray
Nov 03 2016 14:25
For instance @schtauffen showed (me) a new way to wire the model logic that looks very modular.
If you want to look at clean/modular ways to assemble the elements of the pattern, I would definitely look at Meiosis.
Rick Medina
@rickmed
Nov 03 2016 14:29
is meiosis that way which @schtauffen showed you?
how does sagas break the single state tree principle? to clarify, I'm talking about the saga pattern itself, not redux-saga
Fred Daoud
@foxdonut
Nov 03 2016 14:40
@rickmed indeed Meiosis supports "self-contained" components organized by feature. If you look at the temperatures example, the "Air" and "Water" temperature are two instances of the same component. All the related code is contained under the temperature folder. The component manages its own state, has its own model, actions, and of course, view. Nevertheless, the single state tree principle is preserved, because the component's model is nested within the root model. I hope that helps!
Meiosis is a library I am working on to implement SAM.
Rick Medina
@rickmed
Nov 03 2016 14:43
@foxdonut so meiosis is like a way to instantiate/manage several sam instances?
Fred Daoud
@foxdonut
Nov 03 2016 14:43
No, all the components are managed within a single SAM instance.
Rick Medina
@rickmed
Nov 03 2016 14:44
@foxdonut thanks! I'll check it out :)
Fred Daoud
@foxdonut
Nov 03 2016 14:45
welcome!
Fred Daoud
@foxdonut
Nov 03 2016 14:52
@jdubray by the way, as per your suggestion, I formally added State to Meiosis. It is a pure function that computes the application state from the model. You can observe it with the tracer, when the model changes, the state reflects the computation and the view is a function of the state.
meiosis-state.gif
Jean-Jacques Dubray
@metapgmr_twitter
Nov 03 2016 14:54
great, thank you. Sorry, I have not had too much time to implement something with Meiosis, but I am rather busy until the end of the month
Fred Daoud
@foxdonut
Nov 03 2016 14:55
To demonstrate (see animation above), I added two pieces of "computed state": even (true/false) according to the counter being even or odd, and closeToLaunch when the counter is less than 4. Notice how the state values change according to the model.
@metapgmr_twitter sure, no worries, I understand. Just letting you know I appreciate your ideas and am supporting them in Meiosis. :)
Jean-Jacques Dubray
@metapgmr_twitter
Nov 03 2016 15:01
:thumbsup: thank you!
Rick Medina
@rickmed
Nov 03 2016 20:14
@foxdonut is there a meiosis tutorial? can't seem to find it
(from http://meiosis.js.org/ you would click on "Documentation")
Michael Terry
@formido
Nov 03 2016 20:18
Pretty much any programming tech has a hand-holding tutorial, though, which I don't see here
python, react, elixir
Rick Medina
@rickmed
Nov 03 2016 20:19
thanks @foxdonut
Michael Terry
@formido
Nov 03 2016 20:19
oh nevermind
I see it now
excellent
Fred Daoud
@foxdonut
Nov 03 2016 20:49
you're welcome
Rick Medina
@rickmed
Nov 03 2016 21:15
@foxdonut so If a wanted to "componentize" a piece of logic (lets say a drag and drop) I would do it within a meisois component "class". So in the temperatures example, the folder temperature is a component?
Fred Daoud
@foxdonut
Nov 03 2016 21:17
@rickmed I wouldn't use the word "class" because there are no classes involved, but otherwise, you are correct.
Rick Medina
@rickmed
Nov 03 2016 21:17
@foxdonut yes, that is why I put it between quotes to separate a blueprint (temperature) vs an instance (hot and air) correct?
although in that example I can't where it is initialized
Fred Daoud
@foxdonut
Nov 03 2016 21:18
@rickmed ah, I see, yes you are correct
the components are initialized in this code
Rick Medina
@rickmed
Nov 03 2016 23:35
@foxdonut is there an API docs?
Fred Daoud
@foxdonut
Nov 03 2016 23:43
@rickmed not yet, but this indicates what the properties are and what gets passed to each function: https://foxdonut.gitbooks.io/meiosis-guide/content/meiosis_big_picture.html
Rick Medina
@rickmed
Nov 03 2016 23:46
so component returns a view component for whatever view layer you are using correct?