Question

I've been learning some Clojure, and I currently have a single .clj file which I edit in a text editor and which I execute on the command line.

Where can I find a guide on the practical aspects of scaling this up to larger programs/libraries?

  • How should I lay out multiple .clj files on the filesystem?
  • How should I organize and execute test code?
  • How should I document the program/library?
  • How should I package it?

I'm looking for information on the practical aspects on scaling up from small scripts to something real.

Was it helpful?

Solution

I recommend using leiningen. Running

$ lein new myproject

will create a new folder called myproject inside your current working directory with a default skeleton structure.

Inside the newly generatedmyproject folder you'll find (among others) a folder named src for clojure source code and a folder named test for your tests (leiningen will generate a default failing test).

Leiningen will let you run your tests with lein test.

You can package your project as a jar file with lein jar or create an uberjar (an executable jar with all required dependencies included) with lein uberjar.

For generating documentation I recommend autodoc which integrates nicely with leiningen.

OTHER TIPS

If you are using Netbeans, there is a Clojure plugin which could be helpful to you.

Creating a Clojure project with it creates a bunch of folders: Source Packages, which contains a default package called com.yourcompany, Test Packages, Libraries, which contains the .jar for Clojure and a link to the JDK, and Test Libraries, which contains JUnit.

I use a combo of:

Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top