By Ariel Alexi
An OOP developer finding her way in the functional world, what could go wrong?
So why Clojure?
This was my main question to every Clojure developer that I have met, while I was wrestling with myself about the answer to that question. During my studies for a computer science degree, I had the chance to code in various languages and try different technologies. Some of these languages were: OO languages (Python, Java, C++, and C#) and C. Although I am a junior OOP developer, developing into the functional world was always fascinating and interesting. That is why I had the question why from all the functional languages, I need to try and code in Clojure? While I was asking this question to different people, the answer was most often similar “I don’t know but..” and later on there was always the sentence of “…you have to try it and you will understand!”.
So, challenge accepted!
I am going to find out if Clojure makes it or breaks it for me. What could possibly go wrong? I am starting a new journey, a journey I think every junior developer must take - CODE AND TRY! Only by tapping away at the keyboard and trying to solve tasks, you learn what you want to do, and also what you never want to do again.
Bear in mind that I’m an Object-oriented programming (OOP) developer diving deep into the functional world, wish me luck!
What is Clojure and why should we care?
To quote Clojure.org:
Clojure is a dynamic, general-purpose programming language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming. Clojure is a compiled language, yet remains completely dynamic – every feature supported by Clojure is supported at runtime. Clojure provides easy access to the Java frameworks, with optional type hints and type inference, to ensure that calls to Java can avoid reflection.
Where to start?
Clojure was the first language that I had to learn outside of any course at the university and don’t forget it is a functional language, YAY. It was me (with some help from my mentors) vs. Clojure.
There are different books I have tried reading during my study —
- Clojure for the Brave and True by Daniel Higginbotham
- Clojure Programming: Practical Lisp for the Java World by Chas Emerick, Brian Carper, and Christophe Grand
I found that I enjoyed reading the first book. It was a funny and interesting book for a software self-learning book. Along with the book, you get some funny and interesting assignments and read stories to make the journey more interesting. This book is not for everyone, but give it a try. If it is not your cup of tea try the second one, you can always learn in the direct and straightforward (but boring in my opinion) way with the Clojure documentation. From my point of view, you should not learn a new language by its docs. I think you should use the language docs only when you are familiar with things and you are searching for some more small details.
A quick intro for those who don’t know: Rich Hickey is a computer programmer and a speaker, known as the creator of the Clojure programming language.
As a part of my journey in discovering Clojure, I had an assignment to watch one of Rich Hickey’s videos every week. It may sound weird but give yourself an hour to watch them every week. Part of learning Clojure is to understand where and why we need and want it. Rich Hickey’s talks will give you a different perspective about Clojure and coding. In the beginning, I didn’t understand what everyone wanted from me, I had no opinion about them but as I continued watching more videos I started to consolidate my own opinion on the videos and the coding world as a programmer.
This is the list of Rich Hickey’s videos I watched, in the order I watched them:
- Are We There Yet? (2009) — Rich asks whether we’re being well-served by object orientation as it is commonly embodied.
- The Value of Values (2012) — Rich compares place-oriented programming to programming with values.
- Simple Made Easy (2011) — Rich discusses the definitional difference between simplicity and ease.
I think the 3rd video is a must for every developer out there, no matter if you want to use Clojure or not.
How was it to learn Clojure?
As an OOP developer, my first few days with Clojure were something like Conan O’Brien crying
News flash: learning a new language is hard, especially if you are a junior developer. It is difficult because learning a language that is so different from the concepts and fundamentals you already know is hard, so do give yourself some slack.
As an OOP developer, I needed to change my mindset about this new thing and its concept which means - in Clojure there are NO objects! (at least not that I recognized).
You only get data structures and functions, and it’s not an easy task for an OOP developer to throw objects out the window and act like it is all fine and easy. On the bright side, Clojure has a small box of functions and data structures you need to get familiar with and you just need to know how to manipulate them.
But don’t you worry - my opinion about Clojure has changed. Now I mostly feel like this when I’m coding:
You must have been wondering how I have changed my mind over my first month, but this I shall not reveal now. All that I wrote here, the books, and the videos are the first baby steps that usually Clojure developers take before they start to code and practice the examples in the books or the websites. Those are just the ordinary baby steps that people usually take, whereas I believe you should do it differently.
To learn more, you should read my next post.
See you there.