I’ve had some pretty bad experiences with functional programming languages. Haskell in particular. When I was in high school, we had a functional programming unit in my CS course. Up to that point, we had done some educational languages as well as Java. At the time, I thought I had my head pretty firmly wrapped around programming (😅). And then came Haskell. And I did not get it at all. Just couldn’t wrap my head around it.
Thankfully, in University, I wasn’t required to do functional programming. Our main teaching language was Java, and I did some C and C++ voluntarily. FP was only a small part in an overview course on programming techniques.
Then, somewhere in the mid 2010’s, FP was the “fad du jour” in CS for a while. Driven by that, I decided to buy a couple books on FP. But due to my earlier encounter with Haskell, I opted for Elixir instead. It looked interesting. And, quite frankly, I like its “Alchemist” branding quite a lot. Call me a dork if you like. 😉
But that was also the time where I decided that my Master’s degree would never happen and left University for the corporate world. I found my niche in Build Engineering in a rather large C++ project. So my days are spend alternatively losing my sanity bit by bit working with CMake and Ninja, or frantically analyzing Yocto SState Cache misses.
But after slowly crawling up the corporate ladder for a while, I’m now in a tech lead position. Which means I think and talk a lot about problems and their solutions - but I don’t really implement them anymore. If you were to ask me what programming language I mainly work in, the honest answer on more than one occasion would be: Whatever Atlassian calls the markup languages for Confluence and Jira.
Rather long story short: There’s not very much programming going on in my life, and I don’t like it. And I still have some need for programming in my personal life.
My needs are relatively small: I’ve got a C++ CLI program which helps me to keep my smoking vice in check. It’s a very simple terminal app backed by an SQLite DB. I call it every time I have a smoke, and it has a configurable timer for when the next smoke is allowed. It looks something like this:
$ smoking when Thu May 4 12:35:44 2023 (00h:05m:32s) $ smoking smoked Interval has not passed. No event logged. Next Smoke in 00h:04m:54s $ smoking smoked -f Interval has not passed. Forced Event logged at Thu May 4 12:31:12 2023 Next Smoke in 01h:30m:00s
It’s simple, but helps me not to smoke too much, by allowing me to see when I had my last smoke and when I could have my next one. The problem with it: It’s a CLI program. And while I like working on the console, it’s not very useful for when I’m away from my machine. I had thought about implementing an Android app. But for that to work properly, I would need to have a good way for syncing. So I finally decided: Instead of coming up with a way to sync, why not implement a full API and web app? One advantage of this is also that I would finally get to host something I wrote myself in my Homelab. 😁
It will also get rid of the need to manually enter smokes I had while away from my desktop.
From back when I looked at Elixir for the first time, I remembered the Phoenix Framework for Elixir. That has now become my main trigger to dive back into Elixir.
There are also two more long-term goals. I’m using Taskwarrior to basically control my life. It is another terminal app, for task management. I use it for everything, from household chores over Homelab plans to tasks at work. It has served me extremely well. But it never had a great mobile app. There were some attempts, but they weren’t too great. And while it has a sync server that works very well, that uses pure TLS connections, which is a problem when syncing from work, where all external traffic goes through an HTTP proxy.
Then there is Timewarrior from the same developers. This one doesn’t have a sync server at all, which has me manually making entries once I get home.
So there are plenty of things I want to do. And I decided to do them with Elixir.
Some months ago, Humble Bundle had a nice bundle of Elixir programming books I bought. And for my current vacation, I made a plan to get started on them.
When starting a new programming language, I like to get an initial overview, not just over the language itself, but also over the ecosystem, especially with regards to build tools and unit testing. So for my first book, I decided on Programmer Passport: Elixir from The Pragmatic Bookshelf. And I wasn’t disappointed. It starts right away with an introduction to Mix, Elixir’s build tool. I’m now about halfway through that book, and it has provided a nice overview of the language and tooling so far.
One thing I discovered while reading the book is Exercism. It’s a page with exercises on a large number of programming languages. But it’s not just some exercises descriptions. The cool thing about it is that they also have their own tooling.
When I want to start a new exercise, I run a command like this:
exercism download --exercise hello-world --track elixir
This downloads a full Elixir project with a mix setup. Most importantly: It downloads a set of unit tests! So instead of e.g. getting an input and having to provide your solution’s output on the website to check whether it’s correct, you can just run the unit tests. It is really nice, and I will be exploring it for other programming languages I’m already familiar with when I feel the itch to just program a bit.
Once I’m through with the Programmer Passport, I will continue with Learn Functional Programming with Elixir. I’m hoping that that book will finally allow me to get FP concepts into my head. 🤞
Then it’s on to the standard book on Elixir, Programming Elixir. I assume that I will already know the majority of the content by this point, but it’s still a good idea to read through it for things which might have been omitted by the previous two books.
Then I’m planning to tackle an Advent of Code with Elixir to get a better feel for the language. Going by my current progress, that might just be this year’s AoC. 😅
Finally, I will be getting into Phoenix with Programming Phoenix. After that, I intend to also go through Functional Web Development with Elixir, OTP, and Phoenix, which looks like a nice, practical intro to web development with Elixir.
So let’s see whether this old dog can learn an entire bag of new tricks. 😁