Learning Clojure

One of many remarks that I took from Computer Science world in 2013 is the rise of Functional Programming. After years of doubt about its performance comparing the other Programming Paradigm, Functional Programming (FP) finally took its place when most of big players choose to implement FP language in order to handle big data traffic and doing real-time data processing. Scala, has enjoyed the hall of fame in last 2 (two) years, by helping Twitter building their services. Twitter makes some crucial libraries in Scala, and it has been proven that Scala can handle big data better than other programming language, i.e Java or Ruby.

I myself feel very thankful for my almamater for teaching us FP in older days. We learnt Haskell in our Foundation of Programming classes, gave us headaches, because it worked very differently from Java, the first programming language we learnt. One thing that I remembered that FP is helping me to understand the principal of recursion. The recursion code in FP is way more clearer and easier to understand than the Java companion code. But again, we left Haskell in the dust and use Java for the nex assignments until now.

After reading some successful stories about FP implementation, I decided to jump into the same bandwagon. I chose to implement our project at work to get a view about developing Services using FP. To give a brief overview, our current Service built around Java with some Ruby and Python here and there. We use RESTFul to communicate within our modules, and it uses PosgreSQL and some NoSQL databases to store the different kind of data. Based on these circumstances, I think this Project will be very fun to develop using FP.

In 2013, some new FP language finally take the spotlight, giving us another option beside Scala. Don’t get me wrong, I think Scala is great, but the language is very complex. I am looking for more simple approach for FP language, but still can run in Java Virtual Machine (JVM) like Scala. There are some alternatives like Clojure, Groovy and the future, Java 8. The main reason to use JVM-based FP language because it let us to use Java’s 3rd-party library in the FP way. We can reuse the libraries and modules, so we can keep the destruction minimal.

Between Clojure and Groovy, I finally pick Clojure as my next adventure. Clojure has many advantages, as describe in here [1]. Clojure is the most interesting language between the three. It use LISP dialect, where it is so uncommon nowadays.

The next step is to find the good resource to learn Clojure, after doing some Google Search, I found 2 (two) books. The first book is Clojure Programming by Chas Emerick, Brian Carper and Christophe Grand. By reading this book, you will get familiar with Clojure syntax and its capabilities.

The other book is The Joy of Clojure by Michael Fogus and Chris Houser. This book is not for newbie in Clojure. It contains some advanced technique in Clojure that not really easy to understand by beginner programmer.

The other resource for learning Clojure that I’ve found useful is Leiningen. Leiningen is the maven for Clojure, but with much more capabilities. Other than managing your project dependencies, such as libraries and modules, Leiningen also provide a REPL for Clojure. This is the biggest winning feature for me. By issuing lein repl command, I got a full Clojure environment and I can start coding right away. This is the most missing feature from Java IMHO.

At then moment, I am still familiarizing myself with the syntax and patterns, and I hope in the short time I can start my experiment and share the result.

– Fin

  1. http://www.quora.com/Clojure/Why-would-someone-learn-Clojure “Clojure: Why would someone learn Clojure”  ↩


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s