Idiomatic approach for structuring Clojure source code
- by mikera
I'm interested in how people structure their Clojure source code.
Being used to Java, I'm pretty familiar with the paradigm of one class per source code file, bundling all the data and method definitions with appropriate comments and annotations etc.
However Clojure offers a lot more flexibility, and I'm not sure how I should structure my project (likely to end up as a medium sized app, maybe 5,000 lines with three or four distinct subsystems)
In particular I'm wrestling with:
What guidelines should I use to determine whether code should be in a single namespace vs. separated out into different namespaces?
Should each protocol/datatype have it's own namespace + source file with associated set of functions?
When should I require vs. use other namespaces?