James Sofra <james.sofra <at> gmail.com> writes:

> 
> 
> I know that this has come up before on the group and but is this not
> essentially dependency injection where the dependency being injected
> is a name space that presumably follows a particular convention in
> terms of what functions it provides?
> 
> I remember people making it pretty clear that they didn't see the need
> for DI in Clojure so my question is, is this a useful approach? is
> there a better way?
> 
> Cheers,
> James
> 

Hi

I've often wondered about this in the context of testing, particular testing
code with side effects.  In an OO language I'd create an interface for the side
effecting code (I'm thinking of things like DAOs or messaging systems) and
create a mock or dummy implementation for my tests.

Selectively importing different namespaces that define the same set of functions
is treating namespaces like classes / interfaces.  I've never been sure whether
I should feel uncomfortable about this and whether there's a more idiomatic way
to achieve the same thing.  It feels like such a common requirement I'm
surprised there isn't a standard approach.  Although maybe that's the years of
OO programming clouding my thinking.

Cheers
Chris


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to