First, regarding OO. When programming Clojure I never think about adding 
objects to the application, I think "how can I extend the language so it is 
better tailored to my application domain?". And for a lot of domains good 
libraries are already available. So, for the example that you gave I would 
first look at core.matrix https://github.com/mikera/core.matrix. It does 
something which objects can't do; it adds matrices to the language in a 
very natural way.

Second, regarding cyclic dependencies. When programming Clojure I think 
about how data (EDN) flows through my application. Because of this my 
namespaces usually depend on the structure of the data. My namespaces 
rarely depend on namespaces other that those that provide the additional 
language elements that I need (like e.g. core.matrix, core.async, ...). 
This does raise a new problem "how do I check the validity of the data 
flowing in and out of namespaces?". There were several presentations at 
Clojure/conj that addressed this problem. But overall I find this approach 
to work very well, even for large applications, because namespaces are 
highly decoupled and easy to test.

Those are the "tricks" that I use. But I must admit that it has taken me 
many iterations to slowly improve my code. Old habits die hard.

On Friday, December 27, 2013 3:08:04 AM UTC+1, puzzler wrote:
>
> I do like the way Clojure steers you away from all sorts of unnecessary 
> OO-nonsense, and provides most of the raw capabilities of OO in other forms.
>
> However, even if you avoid mutable state, inheritance, and polymorphism, 
> Classes/objects make great namespaces, and Clojure's namespaces can't do 
> everything classes can do, for example, cyclic dependencies.  This was the 
> subject of my blog post yesterday.  Take a look at the following gist code 
> for one of the scenarios that frequently drives me up a wall:
>
> https://gist.github.com/Engelberg/8141352
>
> I'd love to hear any tricks you guys use to deal with situations like this 
> in your own code.
>

-- 
-- 
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/groups/opt_out.

Reply via email to