Thursday, June 05, 2008

My Tryst with Erlang

Of late I have been trying to learn some new dynamic/functional languages. With all the noise about RoR(Ruby on Rails) in the last few years and changes it has brought to the web application development, it was natural to try my hands at Ruby/Rails. Being a REST enthusiast and Rails 2.0 providing support for RESTful Services, I have looked at implementing some services using rails.

In recent times there have been many debates on scalability of Rails applications and concurrency support of Ruby in general being fairly weak, I looked at different directions for a better language to adopt. The ones that had caught my attention in the last few months have been Erlang and Scala. Being a Java developer for the last several years it would have been easy for me to go for Scala. Scala is an OO and functional hybrid that runs on the JVM and has access to java libraries. It is like having the best of both worlds!

But I admit to have been smitten by Erlang for its simplicity, and a language written keeping in mind the basic non-functional requirements of an enterprise system (ex. Reliability, Availability, Concurrency and Scalability). Scala does have some of the key features of Erlang implemented (ex. Actor Libraries for concurrency) albeit in different ways, it still is not in the same league. In the same breath I have to admit that Scala would definitely be a good replacement for Java. This article from Yariv Sadan, an Erlang developer with ErlyWeb, Twoorl etc to his credit, is a great read on the differences beween Erlang and Scala. Steve Vinoski, an Erlang convert has also put down some of his thinkings in his blog.

Coming to my experiences with Erlang, I have been playing with it for a few weeks trying to understand the basic concepts and have written a few sample programs. I am quite impressed by its simplicity when it comes to concurrency, error handling etc. Being in the EAI consultancy for quite sometime I have also looked at some of the Integration Frameworks like RabbitMQ written in Erlang.

Last week I was trying to install Erlang in my MacBook and it was really a tough job. There are no direct OSX distributions of Erlang available. I had to install it using MacPorts and it took me some time to understand the concepts and install Erlang, Yaws (Web Server written in Erlang) and ErlyWeb (Rails type Web Framework written in Erlang) . Intially I had issues (Compiler Issue: can not create executables) with the XCode version (I had XCode 2.5 which is supposed to be compatible with both Tiger and Leopard) and I upgraded it to 3.0. After having gone through developing the first web application, I upgraded my OS to OSX 10.5.3 (the new leopard version). I have not been able to start Erlang in my MacBook now; it gives me this silly “Bus Error”.

I have seen this issue in the MacPorts forum. I hope they fix the issue quickly for me to be able to venture into the beautiful world of Erlang again.