Adventures in Erlang

Since I taught myself to program computers, I’ve always used OOP languages. My first language was C++ but once I’d learned the very basics I soon moved to C# to develop XNA games and throughout my time at university and work I never really came across the functional paradigm for more than a paragraph or two.

Sometime last year I made a few futile attempts to learn Haskell. My problem was I didn’t understand the problem I was trying to solve. So with the new year coming in I decided I was going to take another stab at functional programming but this time I was going to try Erlang.

Erlang isn’t strictly a functional language as it is often described as a concurrent language. But if you want to write a sequential, functional program in Erlang it’s very simple to do and built into the language straight off the bat.

What drew me towards Erlang was the uptime statistics surrounding many Erlang systems. It’s just fascinating from my perspective (I manage and develop around 10 ECOM websites at the moment).

I decided to buy a book and have a proper go at learning Erlang. I’ve since finished the book and I feel like I know a lot about Erlang. The book Programming Erlang was very well written and helped me understand a lot of the core concepts of functional programming right from the get go.

Functional Programming heavily lends itself to Test Driven Development because you know exactly what output to expect with a given input. The side-effectless nature of FP means your tests are as simple as input X make sure Y = Y, there’s no time spent writing Mocks and Fakes or anything else that is needed for Unit Testing an OOP based language.

There are plenty of great Testing Frameworks out there for Erlang, I’m sure a quick Google Search will point you in the best direction for your needs.

I never really feel like I’ve learned a language until I can put it to use without looking up references to get my project set up. With Erlang, I now understand most of the concept and I’ve been using it to solve some of the Project Euler puzzles.

I’m also working on a backend for a project that I am working on, I’m writing it in Erlang because it gives me a nice end goal. Getting used to working with Cowboy and OTP servers is going pretty well but I’m currently having to check guides pretty heavily.

Hopefully one day soon I’ll have a project out in the wild with an Erlang backend.