What is Clojure?

Summary: Clojure is a general purpose programming language designed for the fast-approaching future.

You're a programmer (or want to be one) curious about Clojure. Let me give you some background about it so you can explain it to your friends.

Clojure is a general purpose programming language. It's used by many companies, large and small, including Amazon, Staples, and Walmart. It's particularly good at data processing and concurrent programming, two applications that are becoming increasingly relevant in computing.

Who makes Clojure?

Clojure was originally written by Rich Hickey and released as open source in 2007. It is now maintained by Cognitect, the company at which Rich Hickey is co-founder and CTO, with the help of 125 contributors. The release cycle favors backwards compatibility and stability, yet the language continues to develop new and powerful features. Rich Hickey was dissatisfied with writing concurrent programs in Java and C++ and made several attempts to find a solution until finally writing Clojure.

What makes Clojure unique?

Clojure is unique in several ways. One is that it was designed to be a hosted language. Instead of defining its own platform (as Python, Ruby, Java, etc.) have done, Clojure was meant to take advantage of existing platforms and to build on top of them. Clojure currently is developed on two platforms, the Java Virtual Machine and JavaScript. This gives Clojure incredible reach. Clojure can run wherever Java does, any web browser, or any mobile device.

Clojure has innovated several high performance data structures. These data structures are used heavily in typical Clojure programs. They are immutable, meaning they can't change once they are made, and they are persistent, meaning making modified copies of them is inexpensive. Because they are immutable, they eliminate many typical errors found in most concurrent programming.

Clojure has several powerful concurrency primitives. Concurrency primitives are objects that manage state in a concurrent environment. They make code that deals with multiple threads easy to write and read correctly. Most concurrent programming is based on locks, but locks are notoriously hard to get right. Clojure's concurrency primitives make taking advantage of multiple cores very easy.

What is the tooling like?

The tooling for Clojure is quite mature. Most programmers use the Emacs editor with an extension called CIDER, which gives powerful operations on code and running systems. However, there are a considerable number of vim users and there's an extension for IntelliJ IDEA (a Java IDE) called Cursive that gives a more traditional IDE experience.

The main project management tool is called Leiningen. It manages dependencies, deployments, and versioned releases. It hooks into Maven, where it has access to thousands of Java libraries. But typically, Clojure libraries are deployed to a community-run service called Clojars, which hosts mainly Clojure libraries.

What applications is Clojure used for?

Clojure is used for everything from simple web sites to desktop applications to music synthesis systems to cloud-based Twitter analysis engines to high-frequency trading. It's a powerful tool for building high-leverage abstractions. And its simplicity makes it great for managing the complexity of the real-world. Long story short: Clojure is a great tool for mitigating risk.

What are the principles behind the design of Clojure?

Rich Hickey has established several big ideas in the programming world since the inception of Clojure in 2007. One idea is an objective definition of simplicity, Simplicity is all about how intertwined the concepts and constructs are with each other. Clojure's notion of simplicity allows programmers to deconstruct problems into small parts and put toget her a solution from off-the-shelf components. It means more robust solutions faster.

Another idea that is gaining a lot of traction is the idea of "learn once, write anywhere". It's a play on Java's "write once, run anywhere", which never panned out. Instead, Clojure has some core concepts that you "learn once", then can use them on the different platforms that Clojure sits on top of, namely the JVM and JavaScript. The idea has been adopted by Facebook's React, where instead of trying to write one app for all mobile platforms, you learn the basic concepts and write with the same tools on all the platforms.

What is the Clojure user-base like?

Well, Clojure is a growing community. There are 2 annual Clojure conferences in the US (Clojure/conj and Clojure/West), one in London, and a few in continental Europe (EuroClojure, clojurTRE, :clojured). There's a remote conference for everyone. Clojure has an active IRC channel (#clojure on Freenode) and an active Slack channel. You can ask questions or just hang out. There are lots of resources for beginners out there. Clojure has healthy growth right now and everyone is committed to welcoming newcomers. I publish a weekly newsletter called the Clojure Gazette.

Conclusions

Clojure is a great language to get into right now. It's all set up for the future of multicore machines because of its focus on concurrency. And it's perfect for our world of ever more complicated software. It manages software complexity very well by giving you powerful tools of abstraction. And the community is smart, welcoming, and growing. It's the perfect time to get started with Clojure.