What is it about Clojure?

What is it about Clojure?

So I've been working with Full stack Clojure projects in the last few months. This is the first time I've seen functional programming used in production. FP has always seemed appealing to me, but it is hard to be confident about a tool before really using it. Many of my colleagues who have a longer history of using Clojure in their daily work have praised Clojure and FP so highly I have been wondering what's the big deal. For some of them, Clojure might have been their first functional language so in their case I can certainly relate to the feelings of having your mind blown by the Functional Programming paradigm. For me, most of the features already felt familiar and since I'd even tried to write some Common Lisp programs I wasn't too scared of The Parenthesis. Let's go through some of the most prominent features that Clojure offers for the developer:

Immutable data structures

These guys make reasoning about state and sharing data safe. While I understand the arguments in favor of using immutable data structures, in my experience I haven't been running in to bugs which have a root cause in mutable data structures. Still, after using immutable ones I have to admit appending to a list in Java made me feel a bit dirty.

REPL

Compared to other programmers, Clojurians spend a lot more of their time doing interactive programming in the REPL. The feedback loop is really fast if you know how to leverage it. Many other modern languages have something similar if not quite as powerful as Lisp style REPLs.

Data

Idiomatic Clojure favors using "just data" and functions instead of domain objects and methods. Something like this can certainly be achieved in other languages as well. However, there are few languages where code and data is so similar. The whole thing looks and feels very natural and you don't have to change your way of thinking when data needs to be moved around. If Lisp had been more prominent, we might have stayed in EDN instead of being exiled to the land of XML and JSON. Still, most modern languages handle serialization in a relatively painless manner.

Miscellaneous

There's lots of other stuff like generative testing, pattern matching, logic programming, asynchronous programming etc. that I don't want to get in to here. Most of this stuff has been implemented in other context as well so there isn't really anything that really stands out to me.

So why the fuss?

Well, maybe it is the fact that it is not just the immutable data structures. It's not just the REPL. It's not just clean serialization. It's not just generative testing. It's not just pattern matching, or any of that stuff. In my opinion what makes Clojure stand out is the fact that all of this stuff is readily available to be used and served à la carte so that you can use them where it makes sense. The syntax is dead simple. Once you learn the basics the same idioms are used everywhere. Reading Clojure code is really easy since the structure of the code is pretty much always the same. There is no operator precedence in Clojure. There's an overarching design and elegance to all of the stuff.

And that is why Clojure really, really rocks.

To view or add a comment, sign in

More articles by Matti Uusitalo

  • Katsaus SQL-tietokannan käyttämiseen Clojuresta käsin

    Taustaa Aloitellessani Java-koodarina innostuin heti Hibernatesta. Ei tarvitse kirjoittaa ollenkaan SQL:ää, vaan ORM…

    6 Comments
  • What do you mean, "Full stack developer"?

    Recently there has been some discussion in the tech world about what being a Full stack developer means and whether it…

    1 Comment
  • Peek in to generative testing with Clojure spec

    I wanted to try out Clojure spec so I dug out some of my old Project Euler code and added some definitions. I know the…

  • First shot with Python type hints

    As I mentioned, I'm late to the party but better late than never. Today I got a very interesting recommendation in my…

    1 Comment
  • Why we want short sprints

    Here's the deal. Everyone says one week is the ideal length for a sprint.

Others also viewed

Explore content categories