My last post on Clojure template libraries needs updating already, but before I do that, I’d like to jot down some notes on how I try to evaluate libraries. Ultimately, it’s actually hard to accurately evaluate a library without using it in anger. Sadly, by that point you tend to be committed. Try to find someone who uses Rails heavily to tell you that it’s not fit for purpose.
There’s already ten or so HTML template libraries. You’re not going to use them all before committing, so you need a way to choose which you’re going to try first.
- The first question, of course, is: does it do what you need? It’s usually worth browsing the documentation beyond the first couple of paragraphs of the readme. What you mean by “rest middleware” could be very different from the author’s understanding of the term.
- Is it correct? Clojure is still in its amateur phase. When I looked at node postgres libraries, only one was actually capable of querying the first system table I tried. Unit tests are a good signal. (This is a problem with REPL driven development: there’s no evidence after the fact you did it.)
- Is it simple/composable? Can you vary what it does? Macros, sadly, are a bad sign. If no part of the API takes a function as a parameter, it’s probably not that flexible. Calling yourself a framework is a red flag.
- Is it fast? Given the choice between two otherwise identical libraries, you’ll always prefer the faster. Usually, all you can really tell from the documentation is whether or not the author cares about speed.
- Does it have a community? Large numbers of committers, even large numbers of issues on github are usually a good sign. These make it more likely that the library will continue to evolve as your requirements change.
- Can I change it? This one is horribly underrated. At this point, there’s still a good chance that you’ll find something you want to submit as a pull request. Take a browse of the code and see if it’s a code base you can work with. Watch out for libraries that are really Java libraries, like mustache.clj.