Why Clojure?

Clojure might be considered an unusual choice for a startup's tech stack, even in 2018, but it offers massive advantages if you know how to leverage it.

For several years now I've been a Clojure developer in a variety of places, from agencies to startups to side projects.

That doesn't mean I'm averse to picking up new tools, but when you're starting a project that you'd like to turn into a real business, then you need to pick your tech on the basis of business sense, not (just) because you want to learn something new & shiny.

So, I'm comfortable with Clojure, but more than that, it offers me certain advantages that I just don't find in the same measure in other environments.

These include:

  • simplicity
  • brevity
  • high leverage
  • JVM compatibility
  • front-and-back-end parity through ClojureScript
  • the Figwheel development experience
Simplicity

The creator of Clojure, Rich Hickey, gave a well-known conference talk, "Simple Made Easy" where he describes what simplicity is.
In short, it's not the same as ease of understanding - it's more that if something is simple, then it's made up of separate concerns that aren't entangled.

This strikes a chord with me, and reflects how I see my Clojure development; the language gives me the tools to develop independent, de-complected, individually-understandable elements that can be combined to give me results.

Clojure's promotion of careful management of state and mutability ensures that functions are testable and predictable, and that what you compose from them retains these advantages.

Brevity

Clojure is a terse language; all other things being equal, less keystrokes is better. To my mind, it doesn't lose out on expressiveness through brevity either; this isn't Perl!

Clojure in Emacs

High leverage

Clojure lets me do things that should be hard very simply.
Its' support for concurrent programming is first-class, and concepts like laziness, transducers, Software Transactional Memory (STM) and core.async give me options to express solutions to problems that are traditionally "hard" in a few lines of readable code.

JVM compatibility

The Java Virtual Machine (JVM) is the most tunable, highest performing, most battle-tested platform for shipping applications.

Java provides huge libraries of reusable code used by millions of programmers every day.

Why would you not want to deploy on this platform?

ClojureScript

I never used to be sold on the idea of developing your front and back end apps in the same language - but that was back when the only option was JavaScript (the hideous nature of JS build tools, in particular, turns me off).

ClojureScript, on the other hand, integrates nicely with my normal workflow, lets me transition smoothly from front to back-end without a thought, and Just Works ™

 Figwheel

I never want to go back to a development experience without true hot reloading again. The experience of making a change, flipping to my browser while Emacs auto-saves it and the change popping automatically in my app - without losing my state(!) - never ceases to impress me.

The fact that it works for my markup and CSS as well as regular CLJS code is just the icing on the cake.