Iain Munro

Iain Munro

Software engineer

Erlang Day 0 – Introduction to Erlang

In the course Algorithms Programming language & Paradigms, I was taught the most important programming paradigms and some core languages. However the course can’t cover all of them, so in order to complete it, I received an assignment which included reading the book Seven Languages in Seven Weeks by Bruce Tate.

The goal of this assignment is to take me on an enlightening journey that will challenge the way I look at programming. The instructions were simple: Choose a language covered in the book, do the exercises of that language and create your own challenge. The result of all of this was to be put in a few blog posts, which you are reading now.

The languages that are covered in the book are Ruby, Io, Prolog, Scala, Erlang, Clojure, and Haskell. Out of all these languages, I chose Erlang.

Erlang?

The name might sound strange, but it is an acronym for Ericsson Language. In 1986, Joe Armstrong developed the first version at Ericsson, continuing to develop and polish it through the last half of the decade. Through the 1990s, it grew and gained more traction in the 2000s. It is the language that powers projects such as CouchDB and SimpleDB, popular databases for cloud-based computing. Erlang also powers Facebook’s chat. The buzz for Erlang is growing steadily because it provides what many other languages can’t: scalable concurrency and reliability.

A video I watched years back which first referenced Erlang and joked about the hipster languages like NodeJS and Ruby. It completely changed my view on programming languages and it’s heroin for the soul.

Why Erlang?

Erlang was the kind of language I always wanted to try. The philosophy of lightweight processes and the way it accepted failure always was a big allure to me. Few languages have the mystique of Erlang, the concurrency language that makes hard things easy and easy things hard. Its virtual machine, called BEAM, is rivaled only by the Java virtual machine, for robust enterprise deployment. BEAM compiles Erlang to C using a mix of natively compiled the code and threaded code to strike a balance between performance and disk space.

You can call Erlang efficient, but Erlang’s syntax lacks the beauty and simplicity of, say a programming language like Golang or Ruby.

For a school assignment, the safe option would’ve been Scala. This wouldn’t have been much of a challenge for me, after writing Java applications for the better part of my career. It also wouldn’t force me to write in a functional way, the way Erlang would. Here are some reasons I could think of why I think Erlang is worth a trying and learning from:

  • The problem with languages like Scala is that you can write the same code in 15 different ways. That just gives us 15 different ways to screw up. With Erlang, you don’t have this issue.
  • Hot-swap code. Meaning you can replace pieces of your application without stopping your code.
  • Erlang combines the robust “Let it crash” error strategies.
  • Lightweight as the primary concern. This means, no threads. A different way of concurrency.

1 Comment

DROP A COMMENT

Your email address will not be published. Required fields are marked *