Learning a new language: Clojure

- select the contributor at the end of the page -
Software craftsmanship is very important to me and the dev team here at Pluralsight. And one aspect of that is continuous learning - improving yourself instead of remaining stagnant. As Bob Martin points out in The Clean Coder, if you have the luxury of working 40 hours a week as a programmer, you owe it to yourself and to your employer to spend a significant amount of your own time each week sharpening your skills as a craftsman. One way to do this is to stretch yourself and learn a new language - preferably one that stretches how you think about programming beyond your current paradigm.

I've personally started down that journey recently by learning Clojure.Clojure logo

There are several reasons why this makes sense for me personally, and I'll share some of the main motivations in this article.

Clojure is a functional language.

I've programmed in imperative languages like C# for a couple of decades, so this definitely takes me out of my comfort zone. One of my very favorite features in C# is LINQ, which gave me my first glimpse into the functional style of programming. Embracing Clojure means embracing seqs (seq is an abstraction representing a sequence), and if you enjoy LINQ, you're going to love seqs.

Clojure is a dynamic language.

I've felt pain many times where static typing and all the ceremony around it (interfaces, classes, etc.) feels like it gets in the way of my productivity. I know I've solved the same problems over and over in the context of different static classes, and I'm curious if there's a better way, or if there are just dragons of a different sort lying in wait for me there. I'm going to find out!

Clojure embraces immutability.

And it does so in a very pragmatic way, with immutability as the default. This allows you to keep mutation segregated in a layer above the majority of your application logic, where pure functions are the norm. Pure functions are easier to test because of their lack of side effects. Our team's investigation into DDD has led us to find innovative ways to implement immutable value objects in C#, including using immutable persistent collections. I've personally seen the benefit that immutability can bring, and I love that in Clojure you get all of this by default, with a minimum of ceremony.

Clojure runs on the Java Virtual Machine and can do Javascript too.

The JVM is available just about everywhere, which means you can use Clojure anywhere you can could have used Java. And with its very natural interop mechanism for calling Java classes, you can easily make use of any existing Java library, with a minimum of ceremony (you may be seeing a pattern here). There's also a version of Clojure that produces Javascript as output, which makes it feasible for use in client code as well. That's pretty neat.

Clojure will push me to work on new platform.

I've been using a PC for way too long. I've always had a fondness for Unix. The tools that make Clojure programmers productive (Emacs, etc.) will push me outside of my comfort zone. My MacBook is now getting lots more use, and I'm pretty excited about that - it's a delightful piece of hardware.

Clojure is a language I would feel good about teaching to my kids.

My kids have expressed interest in learning to program, and I've been searching for a language that I would feel good about teaching to them. I decided against C# because I don't want them tied to a single vendor, even though the tools there are pretty intoxicating. Besides, I want to go on an adventure of learning alongside them. I considered Java, but ouch - that really felt like a step backwards. I strongly believe that functional programming and Clojure in particular has legs, and I want to give my kids the best possible leg up should they choose a career in CS. This was what pushed me over the edge to really start exploring Clojure as a language for my own personal growth.

More to come.

I'll post more as I progress in this new adventure. Perhaps some of you readers will join me on my journey!

Get our content first. In your inbox.

Loading form...

If this message remains, it may be due to cookies being disabled or to an ad blocker.


Keith Sparkjoy

Keith Sparkjoy was a Culture Coach at Pluralsight. As a cofounder, Keith was the Chief Technology Officer for many years, building and hosting the website and all things IT. These days there's a whole team of folks taking care of the tech, and Keith is focusing more on company culture, which is one of the most important aspects of a fast-growing business.