1

I am new to Clojure and trying to get a handle on organizing a project's namespaces. I am working on a solver for the knapsack problem. Currently, I have broken the modules into files, but everything lives in one namespace: my-project-name.core. I am using load to manage access across files and it seems like a bit of a kludge. I've drawn a digram of how I think I want the various parts to interface:

architectural diagram

My goal is to be able to work on each of the nodes in the diagram independently. I am trying to come up with a strategy for rational namespace design somewhere between everything in one and each in its own.

In particular I want to be able to swap out the solver and estimating components since these are the most tunable.

3

bbatsov/clojure-style-guide suggests some good rules on how to use namespaces:

As for swapping out components, this is typically better solved using protocols or multimethods than namespaces.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.