AKA: A temporary distraction from my time with Clojure.

This distraction is almost entirely based on my recent experience with Korma, the SQL DSL-of-choice for Clojure.

Korma itself is a great library, and I’m a huge fan. It’s solid dependable and well thought out, well, mostly. And there’s where my problem occurred.

My days are spent working with Oracle and SqlServer. Two technologies that are, by most measures, just unpleasant. They’re good at what they do and where they do it, but the level of standards compliance they support is about nil. So while working with Clojure and Korma I tried to do a limit on a query. You know the old “Select * from my_table LIMIT 20″.

One minor problem though, in Oracle it’s “Select * from my_table WHERE rownum <= 20″. Korma doesn’t place nice with this (admittedly annoying) way of doing things.

Now you might expect this will turn into a rant about making sure that all supported toolchains are FULLY supported, and it very well COULD turn into that, but this time it won’t. Why? Because Korma is open source, and Korma is freely available to fork, patch, modify and use in just about any way you like.

So what does this have to do with public consumption? I wanted to point out all the things Korma does right and where many other libraries could learn. First of all it IS open source, so it’s easy to get to and to modify that’s great but even great FOSS libraries can be hard to change. Where Korma succeeds is in two places.

#1

Readable code. Not only is Korma’s code is to read but it is logically organized and split into reasonable, easy to locate functions. Korma proves that even a relatively complex library can be built in a way that is easily consumed by a Clojure noob like myself.

#2

TESTS! I can not stress this enough. If you push out a library to the public and it’s untested you should be publicly shamed, your face should adorn piñatas and small children should mock your beard.

In short:

I’m finally writing to say something positive, and to remind anyone looking to write libraries I might need to use some day to keep them clean. Once you turn your code loose to the community we will be watching, and we will be judging.