Beautiful Code

A bit of poetry… in Erlang

Almost exactly two years ago, I posted part of what follows at the Inakos blog. That blog is now gone and Erlang Solutions will republish most of its articles soon. But this one in particular, I wanted to have it on my own blog.

With my dad on the left, with my kid on the right

I believe that, as a developer, I’m closer to an artist than an engineer. I see software development as a creative endeavour. One that lets you express yourself in many different ways and generate much more than just 1s and 0s.

But, of course, not all programs or systems are artistically pleasant by themselves. That’s why, when the Inakos needed a flyer for a talk at the ECI that represented the idea of beautiful code, I wanted to be sure to write something actually beautiful. That’s why I borrowed the lyrics of one of the most magnificent songs in history and remixed it using my favorite language: Erlang.

It’s a song that means a lot to me, because it meant a lot to my father (who was also a programmer) and I didn’t fully understand it until I had a son of my own. The first time I sung this song to my kid something clicked in and I finally understood what it meant and how true it was. I wrote the original post right after my son’s 3rd birthday and to this day (a few days before his sixth one) I still think it’s one of my most precious pieces of code.

The Original (Updated)

So, here you have it, one of my favorite songs of all time, but now in Erlang:

For those who have actually read the original, you’ll notice I updated it a bit… with things I learned over these years. I hope you don’t mind.

Something New

Since that one was written years ago, let me give you something brand new as well. It’s based again on one of my father’s all-time favorite songs that I couldn’t comprehend entirely until I could see my life reflected on it as a father. This one was originally written in Spanish, but I think you’ll understand it anyway…

Of course… none of these examples work in Erlang, even when they do compile nicely. Don’t forget that poems and lyrics not always strictly work according to the rules of the languages in which they’re written. This is art after all, right? 😉