If you’ve talked computers with me you know of my extreme fondness for Ruby, so you should be surprised to know that I’m trying to learn Erlang! I want to use Ruby as my full-time programming language but my job requires that I program in C# or C/AL; I don’t see any Ruby (sans Rails) opportunities in the near future, plus, I can’t find a good programming book on Ruby locally, so I decided to give Ruby a break and just have fun with a new language.
While I’ve done some Lisp programming in school but I’ve always felt that I was missing out by not knowing any functional languages. I considered F# briefly but it didn’t excite me at all, beyond the functional paradigm F# doesn’t add anything new, it doesn’t make it easier to solve another class of problems.
Why Erlang? Erlang lets me solve problems differently. It has concurrency built into its DNA—it’s ideal for building fault-tolerant systems, it also supports hot swappable code and it’s functional programming language.
I wish I had it 6 years ago. The old system I worked on was a built on C/C++; if you’ve done worked with pthreads you know how painful it can be to debug a multi-threaded program. Creating a performant and fault-tolerant system is immensely challenging and I was constantly fighting the language, not to mention that I had to come in to work at 5:30 AM to update the system with the latest code. If I could go back in time I would build the server layer in Erlang.
I’ve spent 3 weeks trying to learn Erlang and it has been really fun, functional programming is completely new to me and I feel extremely uncomfortable doing it, but when I look at what I’ve done and realize that it only took half the lines it would normally take to solve the problem I can’t help but laugh.
Related posts:





Are you following the pragmatic press book? I’ve heard it’s pretty in-depth.
Ben Scheirman - 12 Feb 08 at 12:52 am
It may have taken half the lines, but how much time did it take? (I’m not being pedantic I’d really like to know how it compared). ALSO, how readable is the code? That’s beef #482 with me and functional languages: they’re so syntax-y.
James Thigpen - 12 Feb 08 at 8:35 am
Ben: I’m following along with the pragmatic press book which is much better than their Ruby book and their rails book. One gripe, Armstrong doesn’t cover sequential (non concurrent) Erlang enough. If you’re new to functional programming I recommend reading http://www.erlang.org/download/erlang-book-part1.pdf.
James: It took me forever! I’m thinking it’s because I’m a total noob and I’m not used to recursive solutions. So far the code’s been pretty readable, Erlang’s a small language but I’m sure the syntax will get insane soon.
Before deciding on Erlang I looked at a couple of other functional programming languages and one thing that really turned me off was the syntax
Shey - 12 Feb 08 at 9:37 am
Hey Shey.
I did the same thing a couple months ago. Picked up the pragmatic programmers’ book on Erlang as I took a couple weeks off at the end of the year. You really have to start thinking differently, more in math terms unlike procedural or OO design.
The syntax is a bitch. Up til now I was going the other way – Java to Ruby/Groovy where the syntax was less restrictive, more elegant. With Erlang, I could never remember whether a line needed a comma or a period.
I think what’s less important than the “half the lines of code” is the fact that in some sense you have a guarantee that your code is thread safe.
Definitely a lot of fun.
Catch you later.
Abhi - 12 Feb 08 at 11:51 am