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 <kumar.shant...@gmail.com> 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.