2022 is just beginning, Clojure was never as hipster and attractive as it is now, and I’ve decided it is time to share a bit of my quest on learning Clojure with you folks. At the same time, I’ll try to provide some guidance on how to get your feet wet with this amazing language.
A Bit of Context
What is Clojure?
As defined by its creator, Rich Hickey,
Clojure is a robust, practical, and fast programming language with a set of useful features that together form a simple, coherent, and powerful tool.
Among its main features I’d like to highlight:
- Dynamic Development: Clojure is a dynamic environment you can interact with.
- LISP: Clojure is a member of the Lisp family of languages.
- Functional Programming: Clojure provides the tools to avoid mutable state, provides functions as first-class objects, and emphasizes recursive iteration instead of side-effect-based looping. Being impure, it still stands behind the philosophy that programs that are more functional are more robust.
Clojure was designed to be a hosted language and supports the dynamic implementation of Java interfaces and classes. All the code is compiled to JVM bytecode.
What is ClojureScript?
This means that nowadays we’re able to produce code in Clojure that is ready to run in a browser. This is really helping a lot to leverage the usage of this amazing language.
Where am I coming from?
If you’re reading this article, chances are you’re already a professional programmer. But if not, just keep reading, this article is also for you, and maybe you can start your amazing journey into programming today!
No matter where you’re coming from, where should you start learning Clojure?
Where should you start learning Clojure?
Well, first things first. I think you should know a bit about Rich Hickey and his motivation to create Clojure. That’s the best way to understand what’s behind the man and the language.
- Are We There Yet? (2009): In this talk Rich Hickey advocated for the reexamination of basic principles like state, identity, value, time, types, genericity, complexity, as they are used by OOP today, to be able to create the new constructs and languages to deal with the massive parallelism and concurrency of the future.
- Hammock Driven Development (2010): Rich Hickey talks about strategies he’s used personally for solving difficult problems. This is a more general talk, but will make you want to install a hammock in your office 😅
- Simple Made Easy (2011): Rich Hickey emphasizes simplicity’s virtues over easiness, showing that while many choose easiness, they may end up with complexity, and the better way is to choose easiness along the simplicity path.
- The Value of Values (2012): Rich Hickey compares value-oriented programming with place-oriented programming, concluding that the time of imperative languages has passed and it is the time of functional programming.
After getting through these videos, I’d definitely recommend you read the Love Letter To Clojure, from Gene Kim, and my favorite book of all time: Clojure for the Brave and True, a great pearl written by Daniel Higginbotham. It is free to read online, written with a great sense of humor, and guides you from zero to hero, raising awareness on the main aspects and functionalities of the language. Make sure you read it at least till the end of Part II.
At this point in time, you should be ready and anxious 😅 to get your hands dirty and start to tackle some challenges in Clojure.
Well, if you’re not proficient with Emacs, I’d recommend you go with VSCode. There’s a great addon for VSCode, called Calva, which will provide you with the essential tools to connect to or start a REPL. It also includes inline code evaluation, Paredit, code formatting, a test runner, syntax highlighting, linting, and more. It’s free to use, and it exists thanks to Peter Strömberg aka PEZ.
Other important resources
By now, you might be already be able to tackle some Clojure challenges. Still, there are some obstacles in the way, such as tooling and frameworks.
Main difficulties along the journey
I think my journey to learn Clojure was pretty straightforward, although I had some small difficulties along the way.
My first obstacle was wanting to learn Emacs while learning Clojure. I totally recommend you to stick to your code editor, otherwise, there will be a lot of new things around and frustration can rise a bit. VS Code is an excellent option, as it is a very simple code editor. Plus, nowadays it provides you with great functionality and support for learning.
Also, the Clojure community is very mature, so don’t expect those very, very, beginner-friendly tutorials, where everything is explained step-by-step. The way I found to overcome this was to join Clojurians Slack. Despite being small, and mature, the Clojure community is very warm and happy to see someone new joining in. So, if you have any questions, don’t hesitate and feel free to post them there. Even those “not so dumb” questions are answered quickly and always with a very didactic approach.
You’ll be surprised as to how common it is for the creator of a library to directly answer you. This rocks, as you’re always talking with knowledgeable people, which are ready to teach and help you on a daily basis.
Last but not least, tooling got in my way a bit. More woth Clojure, than with ClojureScript, I found it a bit difficult to put all the pieces of the puzzle to build a backend. There are a lot of packages to mix and lots of new documentation to read. Watching Jacek Schae and Eric Normand’s courses provided great help with these difficulties, and that’s why I totally recommend tehm.
Have you already taken these steps and gained experience with Clojure? Check out Flexiana’s current job openings and apply to join our multinational team.