Tuesday, September 2, 2014

The road to Erlang

It's been a long while since I've taken the time to write about my journey in programming languages. While I haven't been writing I've been coding/deploying to production in F#, more recently I've been granted permission to code a few smaller projects in Erlang (which I've grown to love). Unfortunately, the day to day situations are much like other situations that I've encountered in the past. Basically, everyone else on the development team are not enthused enough by functional programming to actually learn it and apply it outside of C#. Meanwhile I'm moving on from hard core functional programming to more of a functional programming with an emphasis on concurrency style of programming.
Concurrent oriented programming - this is a form of programming in which computations are executing during overlapping time periods (concurrently). While developing/deploying concurrent solutions (mainly geared around mailbox processors) in F# I've learned quite a bit about how to design messages, processors, and structure to ensure a clear and clean architecture. Unfortunately, when I got started doing this there wasn't much support (as there is now) available in the F# community to help me with designing the essential elements that one must have when building this kind of a system. That is proper fault tolerance, instrumentation, and code upgrades. These are (IMO) essential elements to have when designing and deploying F# agent based systems, unfortunately, I had to build all of these elements myself (which I admit is a price to pay for adopting technology approaches prior to having mature community or language support). Through out this experience I've learned that I absolutely love agent based systems combined with functional programming techniques and when developing such systems on the .NET platform nothing beats F#!  That said, I also learned that I had to venture out to other (more mature) languages and platforms that are similar (to what I was building) in nature for guidance... that led me to Erlang. Erlang was my compass to exploring and designing agent based systems in F#, the techniques, approaches, and tools were absolutely magnificent and had me so bummed out that I did not have any of that in F#. Still, I managed to do what I could under the time constraints that were handed to me. The last couple of years (while I was coding production solutions) I've learned a great deal about myself and about online systems built in F#, which is why I've made the decision to move away from .NET and fully embrace the world of Linux/Unix and Erlang.

This will be a slow move (as .NET still pays the mortgage) but a definite one, one that needs to be made.
In the last three months I've purchased a few Arduino devices along with a raspberry pi to start implementing an idea that I've had for quite a while. I've even resurrected a few old desktop windows machines by formatting them and installing linux to build out a small linux LAN. This process has been so much fun because I've forced myself to learn more about networking, distributed programming, and embedded programming with Erlang.  I'm now teaching myself how to program Bluetooth devices with Erlang which is surprisingly similar to basic TCP socket programming... who knew!? There are many many reasons why I've made this choice but the one that stays at the top of the list is: "Using Erlang makes me a better engineer". This language/platform is not bogged down by libraries and frameworks that hide the real computer science that is going on (which I'm now at a point in my career where I can say that I appreciate that). It keeps with the spirit of functional programming while forcing me to model the program as a tree of concurrent activities that reflect what is observed from the real world. Best of all, the essential elements (that I talked about before) are all built-in to the language/runtime as mature, well tested, language/runtime support, and it's just plain fun! As I go forward from here I expect to write more about my experiences with Erlang and there may also be some bits about F# that I encounter from time to time.

The following references have been instrumental to helping me learn Erlang. I highly recommend all of the references and feel that the purchases are well worth the knowledge you'll gain.

Books
http://amzn.to/1rL5wHA   Programming Erlang: Software for a Concurrent World
http://amzn.to/1vJFODX   Erlang Programming
http://amzn.to/1rL5CPr     Learn You Some Erlang for Great Good!
http://amzn.to/1CncpRU   Designing for Scalability with Erlang/OTP: Implementing Robust, Fault-Tolerant Systems
http://amzn.to/Y9cOIe    Building Web Applications with Erlang: Working with REST and Web Sockets on Yaws
http://amzn.to/1nwunYj   Concurrent Programming in Erlang (2nd Edition)

Videos
http://oreil.ly/SgfWxU   Erlang by Example with Cesarini and Thompson



It's time for a change!