Ask HN: Who is using Clojure in production, and would you do it again?
Running a quick `cloc` on my company&#x27;s codebase shows we have about 40,000 lines of production Clojure code. Most of it supports a couple or three web apps.<p>For me, deploying production Clojure has been fantastic. Is it a panacea? No, definitely not. If you like typing, stay clear. Spec is cool. Very cool. But it&#x27;s not static typing. And, if thinking in s-expressions doesn&#x27;t come natural within a reasonable amount of time, consider Elixir instead.<p>I do, however, prefer dynamic languages, and I frankly LOVE LISP, so it suits me. The JVM has never been a hindrance; in fact, I appreciate the comfort of knowing there&#x27;s a deep ecosystem of Java that can be tapped, which I have (easily!), in extreme situations like PDF manipulation, or whatever.<p>Clojure also meets its performance claims – it&#x27;s fast. My company doesn&#x27;t carry behemoth level request loads, so I can hardly provide impressive metrics, but decently considered code will execute plenty fast with room to spare. Although we&#x27;re light users, Clojure&#x27;s concurrency features are nice too. For most async stuff, forget background job processes – use futures. core.async is cool, but overkill for most web stuff. We&#x27;ve built a bare-minimum job processor for must-finish tasks, but that got done in about 100 lines of code.<p>My major piece of advice, if you plan to use Clojure for the web, is to get comfortable building custom homes for your web apps. Not in the sense that you&#x27;ll HTTP stuff from scratch – no, there are <i>excellent</i> libraries for all of the critical stuff. Redis, AMQP, ORMs and SQL libraries of all flavors, caching, routers – everything you&#x27;d want for the web is there.<p>Just be mindful of the fact that your web app will look nothing like your neighbor&#x27;s. There are NO integrated web frameworks. Not successful ones, at least.<p>And, I think, for good reason. Clojure is not the average Clojure developer&#x27;s first language. There was a significant influx of Rails devs several years ago. Clojure is bereft of black magic. A lot of Clojure libraries are so small, and so sharp, you can easily unearth their features by reading a few source files. Which, of course, is good and bad. The side effect, being, very little of the documentation in the community is geared towards beginner programmers. Starting out, my single biggest frustration in the Clojure community was the <i>knowledge library authors assumed you brought</i> to the library.<p>I&#x27;d compare the ecosystem – loosely – to NPM&#x27;s, but without the cruft. You build your web app up from small components (Component and Mount are awesome!... eh, except for the fact that they are, as are so many Clojure things, original material that takes time to digest...) that easily fit together. It&#x27;s a breath of fresh air knowing almost all libraries live in harmony.<p>So, the backend Clojure story, in my view, is great – if you don&#x27;t mind being on your own once in a while.<p>The front-end story, however... well, is a mixed bag, I think. Yes, ClojureScript is making huge strides in being futuristic and compiling to negative kilobytes an&#x27; all. But some of its highest profile projects are sadly proving impenetrable. Om and Om.Next are total non-starters for small to mid-sized projects (YMMV) as their documentation is so beyond comprehensible. I _have_ made a real project in Om.Next – with tremendous effort – but I&#x27;ve been developing in Clojure for nearly five years. And, when you can&#x27;t remember how something works a day after you wrote it... that&#x27;s trouble.<p>If you want Clojure for the front-end (which we&#x27;ve dabbled in to a degree, but for our company, the return on beginner Javascript developers in React is still satisfyingly high), I&#x27;d recommend Reagent. Keep it simple.<p>Back to Clojure proper, one thing I enjoy immensely is seeing how far I can take a program in a single file. Not always practical, but it&#x27;s fun knowing you can scan a file (often starting at the bottom) and quickly grok it. Do know, however, reading Clojure (or any LISP, that is) is sometimes harder than writing it, especially in a large codebase. It&#x27;s here, I think, where statically typed languages have an edge on Clojure – refactoring is more dangerous: you can never fully tell the shape of data passing between functions.<p>Spec has helped, for sure. For simple, obvious tasks, take a risk. On mission-critical-can&#x27;t-break-type stuff, however, you&#x27;ll be grateful for spec. No, it&#x27;s not the anxiety-free experience you hear about in Elm or Haskell, but geez, at least you can get fresh code working <i>fast</i>. It&#x27;s here where I continue to believe dynamic languages like Clojure have a permanent place in history – solving problems iteratively, with little pomp and ceremony, without knowing the end from the beginning. And saying to yourself, &quot;Yes, this works, and while not perfect, I made it quickly, and it&#x27;s extensible and maintainable.&quot;<p>The most beautiful thing about writing a production app in Clojure is this: you can build a big app from tinier programs. I don&#x27;t mean microservices. I mean small, easily divisible namespaces in a single project that talk to each other via messages. Like, really, you can easily treat separate namespaces as if they&#x27;re different actors in a plug and play network.<p>A talk I heard recently (can&#x27;t remember where) suggested writing your big program from small programs, small enough that any individual program can be rewritten in a week. Clojure does this for us. When I started out, being unfamiliar with functional paradigms in general, I brought a lot of tightly coupled OO practices that I had to unlearn. Unfortunately, &quot;real world&quot; Clojure tutorials are scarcer than they ought to be. But, unlike in my Ruby and Java days, there are _very few_ things that need to be completely rewritten in Clojure. The core language is simple enough that almost all Clojure code resembles itself.