Re: which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-06 Thread Eldar Gabdullin
You can have a look at https://github.com/dar-clojure/container and a bit 
far-fetched example .


четверг, 5 февраля 2015 г., 21:52:53 UTC+3 пользователь Juan A. Ruz 
@tangrammer написал:
>
> Thanks to all for your good points!
>
> Sorry for the delay answering but I needed to review the docs first, now 
> I'll try to be brave and summarise here Graph vs Component features and/or 
> properties ...
>
> 1. *graph* and *component* solve "dependency injection" 
> 2. *component* solves "state management" (Lifecyle protocol and SystemMap 
> record)
> 3. *component* comes with "reloaded workflow"
> 4. *graph* lets you "analyze, change and compose" your functional 
> computation
> 5. *component* forces you to use defrecord
>
> Ok, so I'm convinced now that component is great for state management!
> ... but, *how can you "analyze, change and compose" the internals 
> (functional computation) of your defrecords???*
> I mean that component lib is really great for composing your system (and 
> repl development including mocking components!) but forces you to use 
> closed component that others projects can't *easily* extend [1] or change,
> so for example, which would be the good pattern to follow if you need 
> monitoring/logging your system in *component (*having that defrecord 
> limitation)? 
>
> what do you think if you *write your components using graph*?
> So we keep 
> + system composable using component
> + component composable using graph
> => example code here 
> 
>
>  
> Thanks again!
> Juan
>
>
> [1] This was my own newbie attempt to extend defrecords 
> tangrammer/defrecord-wrapper 
>  , and milesian/aop 
>  the component integration one
>
>
> El miércoles, 4 de febrero de 2015, 13:46:33 (UTC+1), Juan A. Ruz 
> @tangrammer escribió:
>>
>> Hi guys!
>>
>> Can anyone give some insight on the features or downsides of choosing 
>> component vs graph libs?
>>
>> Or maybe explain the advantages of using defrecords instead of plain fns?
>>
>> thanks in advance! 
>> Juan
>>
>>  
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-05 Thread Juan A. Ruz @tangrammer
Thanks to all for your good points!

Sorry for the delay answering but I needed to review the docs first, now 
I'll try to be brave and summarise here Graph vs Component features and/or 
properties ...

1. *graph* and *component* solve "dependency injection" 
2. *component* solves "state management" (Lifecyle protocol and SystemMap 
record)
3. *component* comes with "reloaded workflow"
4. *graph* lets you "analyze, change and compose" your functional 
computation
5. *component* forces you to use defrecord

Ok, so I'm convinced now that component is great for state management!
... but, *how can you "analyze, change and compose" the internals 
(functional computation) of your defrecords???*
I mean that component lib is really great for composing your system (and 
repl development including mocking components!) but forces you to use 
closed component that others projects can't *easily* extend [1] or change,
so for example, which would be the good pattern to follow if you need 
monitoring/logging your system in *component (*having that defrecord 
limitation)? 

what do you think if you *write your components using graph*?
So we keep 
+ system composable using component
+ component composable using graph
=> example code here 


 
Thanks again!
Juan


[1] This was my own newbie attempt to extend defrecords 
tangrammer/defrecord-wrapper 
 , and milesian/aop 
 the component integration one


El miércoles, 4 de febrero de 2015, 13:46:33 (UTC+1), Juan A. Ruz 
@tangrammer escribió:
>
> Hi guys!
>
> Can anyone give some insight on the features or downsides of choosing 
> component vs graph libs?
>
> Or maybe explain the advantages of using defrecords instead of plain fns?
>
> thanks in advance! 
> Juan
>
>  

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-04 Thread Ben Mabey

On 2/4/15 5:46 AM, Juan A. Ruz wrote:

Hi guys!

Can anyone give some insight on the features or downsides of choosing 
component vs graph libs?


Or maybe explain the advantages of using defrecords instead of plain fns?


The two are not mutually exclusive. We use both to manage our system's 
lifecycle.  Here is the library we released to do that:

https://github.com/RedBrainLabs/system-graph



thanks in advance!
Juan
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient 
with your first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Clojure" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-04 Thread Shantanu Kumar


On Wednesday, 4 February 2015 19:36:58 UTC+5:30, tbc++ wrote:
>
> Most of the time, if you are using a component like system, you'll also 
> want some level of polymorphism as well. This is what the defrecord 
> approach enables, it not only provides dependency injection, but also 
> provides a type that calls to that component can dispatch against. In 
> testing it's then quite easy to swap out a component with a mock component, 
> that's something that's pretty hard to do with just functions. 
>

True. With Prismatic graph, one needs to build one dependency-graph per 
profile (i.e. prod, each test suite etc.) though the test profiles (where 
one wants mock impl) may require much smaller graphs depending on the scope.

Shantanu
 

>
> Timothy
>
> On Wed, Feb 4, 2015 at 6:42 AM, Shantanu Kumar  > wrote:
>
>>
>>
>> On Wednesday, 4 February 2015 18:26:43 UTC+5:30, Lucas Bradstreet wrote:
>>>
>>> Component is more for managing state, whereas graph is for structuring 
>>> computation. All I can really tell you is that after using component I am 
>>> never going back (at least in Clojure).
>>>
>>
>> With Prismatic graph you can structure a hierarchy of functions that 
>> initialize parts of app and return functions/protocol implementations, thus 
>> using it like a dependency injection mechanism. The advantage is you don't 
>> have to pass a giant map around in the app, avoiding runtime overhead. The 
>> downside is, this style makes REPL-driven development more challenging.
>>
>> Shantanu
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> 
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking 
> zero–they had no way to indicate successful termination of their C 
> programs.”
> (Robert Firth) 
>  

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-04 Thread Timothy Baldridge
Most of the time, if you are using a component like system, you'll also
want some level of polymorphism as well. This is what the defrecord
approach enables, it not only provides dependency injection, but also
provides a type that calls to that component can dispatch against. In
testing it's then quite easy to swap out a component with a mock component,
that's something that's pretty hard to do with just functions.

Timothy

On Wed, Feb 4, 2015 at 6:42 AM, Shantanu Kumar 
wrote:

>
>
> On Wednesday, 4 February 2015 18:26:43 UTC+5:30, Lucas Bradstreet wrote:
>>
>> Component is more for managing state, whereas graph is for structuring
>> computation. All I can really tell you is that after using component I am
>> never going back (at least in Clojure).
>>
>
> With Prismatic graph you can structure a hierarchy of functions that
> initialize parts of app and return functions/protocol implementations, thus
> using it like a dependency injection mechanism. The advantage is you don't
> have to pass a giant map around in the app, avoiding runtime overhead. The
> downside is, this style makes REPL-driven development more challenging.
>
> Shantanu
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-04 Thread Shantanu Kumar


On Wednesday, 4 February 2015 18:26:43 UTC+5:30, Lucas Bradstreet wrote:
>
> Component is more for managing state, whereas graph is for structuring 
> computation. All I can really tell you is that after using component I am 
> never going back (at least in Clojure).
>

With Prismatic graph you can structure a hierarchy of functions that 
initialize parts of app and return functions/protocol implementations, thus 
using it like a dependency injection mechanism. The advantage is you don't 
have to pass a giant map around in the app, avoiding runtime overhead. The 
downside is, this style makes REPL-driven development more challenging.

Shantanu

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-04 Thread Colin Yates
You might also want to consider prismatic schema if you are evaluating your
tool stack. I too would condone component,  and the various component
compatible libs that have sprung up.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-04 Thread Lucas Bradstreet
Component is more for managing state, whereas graph is for structuring 
computation. All I can really tell you is that after using component I am never 
going back (at least in Clojure).

Lucas

> On 4 Feb 2015, at 20:46, Juan A. Ruz  wrote:
> 
> Hi guys!
> 
> Can anyone give some insight on the features or downsides of choosing 
> component vs graph libs?
> 
> Or maybe explain the advantages of using defrecords instead of plain fns?
> 
> thanks in advance! 
> Juan
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-04 Thread Juan A. Ruz
Hi guys!

Can anyone give some insight on the features or downsides of choosing 
component vs graph libs?

Or maybe explain the advantages of using defrecords instead of plain fns?

thanks in advance! 
Juan

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.