I’m a technical consultant and I work on a quite closed platform. This means that I don’t have much exposure to cutting edge technologies hence new programming languages. That’s why in order to keep my skills up to date I have to be proactive and learn new stuff on my own.
On the other hand I quite liked Python. The syntax is very clean, the language together with its vast core library is very powerful and there’s a big community around it which makes extremely easy to learn this wonderful language.
However it wasn’t enough. I was really looking for something new, something which could finally satisfy my continuous research for the “new”. The thing is, Java, Python, Perl, Ruby and so forth, they all share one thing in common: They all are imperative languages. This means that even if I was going to learn a new syntax and new libraries, I was already able to predict what the language was going to be like.
Imperative languages are so called because they are made of “statements” which instruct (order!) the machine “how” to do certain things to accomplish a particular task. Therefore, programming using imperative languages means creating programs which execute by changing their behaviour during the execution flow. So, even though I was going to learn a new language, I was not going to learn a new paradigm.. a new “way” to solve problems.
I’m not criticising all the aforementioned programming languages (who am I to dare?) but I’m just saying that I really wanted to see the art of programming from another perspective.
As you might know, programming languages are divided into two main categories:
- Imperative Languages
- Declarative Languages
Declarative languages comprise all languages which achieve a given task by declaring what results to obtain by their execution, without any mention on how to achieve such a result. I finally found what I was looking for.. a different (but far from new) approach to problem solving. Functional programming falls into the category of declarative languages and since it seems to be the new trend, I’ve decided to give it a go.
The most popular functional programming languages at the time of writing seem to be Heskell, Scala, Clojure, Scheme, F#, Erlang (and sorry if I forgot any).
All the people who were learning functional languages were interested to Heskell or Scala so I decided to go for… Clojure of course Clojure is a fairly new language which is based on a very old functional programming language I didn’t have the pleasure to study at uni (my teachers thought that Pascal was better!!). I’ve also heard in a couple of podcast that’s a challenging and very interesting language. So, here I am!!
I know, it’s not a “noble” reason to start learning a new language but I don’t regret it and after all I’m doing this for “fun”.
Now, I have started learning Clojure a couple of weeks ago and these are the main features of this fantastic language I’ve been able to grasp so far (I’m surely forgetting something):
- Rich Hickey was its inventor in 2007. Someone says he is set to be one of the most influential software developer in the IT panorama.
- Clojure is a (non-pure) functional programming language (doh!). This means that in Clojure functions are first-class objects. You can pass objects as argument to a function and functions can return other functions as result of their computation.
- Clojure runs on top of the JVM. This means you can potentially compile a Clojure script into a .class file and run it everywhere (that’s the Java motto at least).
- As a consequence of point 2, data in Clojure is immutable. If you pass a list of values to a function, you’re guaranteed that the function will not change the content of the list. This is a very important aspect with relation to concurrent programming in a multicore environment which is going to be thread safe (enforced by the language) with no need of locks.
- Clojure is almost syntax-less. All you have to do is working with s-foms (basically lists) at all time. Being a functional programming language, source code in Clojure represents the data your program is going to process.
- I was almost forgeting. Clojure is the most recent dialect of Lisp.
I apologise to all the “purist” if this article sounds a bit unformal but I hope my next articles on Clojure will be.
What do you think about Clojure? Is there anything you would like to add or crticicize?
I promise, unless you are a spammer, your comments won’t be deleted