Re: Composing Stuart Sierra's components

2015-04-16 Thread Dan Kee
Ah, that makes sense. Thanks for the thorough response! On Thursday, April 16, 2015 at 7:00:16 AM UTC-5, Stuart Sierra wrote: > > Hi Dan, > > The key to understanding what's happening here is to > remember that `component/start` combines both dependency > ordering *and* dependency injection. > >

Re: Composing Stuart Sierra's components

2015-04-16 Thread Stuart Sierra
Hi Dan, The key to understanding what's happening here is to remember that `component/start` combines both dependency ordering *and* dependency injection. Your "super system" looks like this just after it is constructed: {:system {:foo {}, :bar {}}, :system2 {:baz {}, :qux {}}} When yo

Re: Composing Stuart Sierra's components

2015-04-15 Thread Dan Kee
Sorry to resurrect an old thread with a somewhat tangential question but... I'm seeing strange behavior in nesting systems that I am hoping someone can explain. I have two independent systems as components of a super system, with an artificial dependency to attempt to enforce ordering of starti

Re: Composing Stuart Sierra's components

2015-03-18 Thread platonovadim
A possible implementation for the idea expressed in the previous post - https://github.com/stuartsierra/component/pull/25 On Wednesday, March 18, 2015 at 2:41:46 PM UTC+1, platon...@gmail.com wrote: > > I've also been investigating the nested system approach/problem. > > The primary use case tha

Re: Composing Stuart Sierra's components

2015-03-18 Thread platonovadim
I've also been investigating the nested system approach/problem. The primary use case that I have is composing subsystems which are mostly independent modules using a higher order system to run in one process. The modules themselves can be easily extracted into separate applications thus becomi

Re: Composing Stuart Sierra's components

2015-03-18 Thread Stuart Sierra
On Tue, Mar 17, 2015 at 5:47 PM, James Gatannah wrote: > FWIW, we've been using something that smells an awful lot like nested > systems for months now. I never realized we weren't supposed to. > It's not that nested systems *never* work, but from what I've seen they cause more complications th

Re: Composing Stuart Sierra's components

2015-03-17 Thread Colin Yates
Hi James, Do you have a code fragment/gist for the glue? On 17 March 2015 at 17:47, James Gatannah wrote: > > On Thursday, March 12, 2015 at 10:16:10 AM UTC-5, Stuart Sierra wrote: >> >> On Wednesday, March 11, 2015, Colin Yates wrote: >> >> Nested systems don't really work. > > > FWIW, we've be

Re: Composing Stuart Sierra's components

2015-03-17 Thread James Gatannah
On Thursday, March 12, 2015 at 10:16:10 AM UTC-5, Stuart Sierra wrote: > > On Wednesday, March 11, 2015, Colin Yates wrote: > > Nested systems don't really work. > FWIW, we've been using something that smells an awful lot like nested systems for months now. I never realized we weren't supposed to

Re: Composing Stuart Sierra's components

2015-03-12 Thread Colin Yates
I like the idea of passing in the *key* of the external collaborator - that's nice. Thanks Stuart. I am surprised there isn't more call for nested systems - maybe there is and this solution is sufficient-enough... Again - thanks Stuart! On 12 March 2015 at 15:16, Stuart Sierra wrote: > On Wedne

Re: Composing Stuart Sierra's components

2015-03-12 Thread Stuart Sierra
On Wednesday, March 11, 2015, Colin Yates wrote: > I can't merge the two systems because the reusable > component is chocka full of very fine grained command > handlers and both the internal and external systems will > have their own 'bus' for example. I could namespace the > keys but that again fe

Re: Composing Stuart Sierra's components

2015-03-12 Thread Colin Yates
merge won't help as there will be name space clashes. I wonder if a more elegant approach would be to construct the 'inner' system and then assoc onto it the external dependencies it needs before calling start. On 11 March 2015 at 18:49, wrote: > I believe I misunderstood your question; I didn'

Re: Composing Stuart Sierra's components

2015-03-12 Thread Colin Yates
Hi Jonah, This is quite comparable to micro-services - each service is an abstraction or at least a facade and wants to play in a bigger system, but each micro-service may itself have its own stateful graph to maintain. I think I will explore my original direction of having a AComponentWhichDr

Re: Composing Stuart Sierra's components

2015-03-11 Thread Jonah Benton
Hey Colin, it sounds like: * if the 2 systems really can't function without each other, and their start/stop lifecycles are tightly bound, then somehow they have to be merged into a single system or * if the 2 systems can't be merged into a single system because of true functional or lifecycle i

Re: Composing Stuart Sierra's components

2015-03-11 Thread adrian . medina
I believe I misunderstood your question; I didn't realize it was system (as opposed to any general component) specific. I think systems can be merged together (via 'merge'). Would that help? On Wednesday, March 11, 2015 at 2:40:14 PM UTC-4, Colin Yates wrote: > > Hi Adrian - I don't follow how

Re: Composing Stuart Sierra's components

2015-03-11 Thread Colin Yates
Hi Adrian - I don't follow how that helps integrate two different systems - I wonder if my question was unclear or I am missing something in your answer. Would you mind posting some pseudo code to clarify please? On 11 March 2015 at 18:32, wrote: > You can specify component dependencies using th

Re: Composing Stuart Sierra's components

2015-03-11 Thread adrian . medina
You can specify component dependencies using the 'using' function as you know. As long as you know the key of the component in the system you can specify this dependency wherever you construct the component. If you want to parameterize dependencies, write a constructor function which takes the

Composing Stuart Sierra's components

2015-03-11 Thread Colin Yates
I have a non-trivial component which requires a bunch of internal and external collaborators to work. This component is itself re-usable. What I really want to do is have ReusableComponent be a component in a system so it can pull its external collaborators. However, ReusableComponent construc