My developer journey into Erlang, Elixir and the Phoenix Framework.
Work on almost any large project these days in a multi disciplinary Agile team, and often you find your are working with 20, 30, 40, 50 different technologies…
I’m a frontend developer by trade, and if like me you’re more than a few years into building website user interfaces, you may remember life before the big 3 current js frameworks (React, Vue and Angular). Yes for me React is a framework.
I remember those days well having spent the best part now of 20 years, essentially writing code for the DOM, I’ve seen the constant churn of js frameworks, the endless evolution of tools, the growth of complexity, and the changing landscapes of design trends and patterns.
Even a few years ago most frontend developers spent large parts of their day fixing IE bugs, chaining Jquery, or building UI’s for server render pages (maybe with a light sprinkle of Knockout say).
Here we are at the end of 2020 and like most frontend developers, I find I’m in some kind of endless race to keep current… yes the frontend has become a vastly complex tangle of technologies, tools, build steps, tests and deployment pipelines.
These days you adopt your js flavour of choice maybe React or Vue or something a little more exotic, you choose what version of ECMAScript you write in, and what version your targeting, you often add state management, you might pull some cdn links for things like dates, validation, animation, fonts and analytics…
You find your js of choice actually requires Node, and suddenly you pulled in a hundreds of other packages that it requires, you then find your not working in the DOM but something called a shadow DOM, and find you don’t just have a backend … but also another backend for your frontend,
You suddenly have webpack, and strange config files. Git repos, branches, you often need a node database like express, a need to be call apis that could be rest or graphql, you load Axios, grasp hydration, and event cycles and loops. You pick a Css frameworks, and therefore tool chains for scss compiling, testing frameworks, js compilers, and build tools. You still have those real basics to remember like semantic HTML, plus the hundreds of browser versions, new standards, css flex and grid, all the devices, resolutions, and accessibility/usability and UX concerns.
We’ve also been slowly moving all the logic onto the client, the push to the single page app, The frontend nowadays is often a mirror of the backend, often even a replacement! or maybe you view static site generators are the future and essentially talking all that complexity and converting it back to a static site for production.
Its not just the frontend, its the same on the server side, and also for dev-ops, there is the slew of considerations in the team, micro-service architectures, various languages, cloud services like azure or kubernetes, lambdas, CDNS, Docker containers, Swagger, Server less, Api paradigms, complex data transformations, authentication, authorisation, validation…
The list goes on and on, all of this isn’t considered a particular complex project… in fact its the baseline of most modern projects.
Each tools is often not too complex (in isolation), but each has its own set of docs, methods, quirks and set of patterns (and bugs)
These are not project specific, each tool was developed to make a task either more robust or even with the aim of making life easier, but this is just the infrastructure, the set of tools we have created to make our live easier, often the bare minimum considered to make modern apps work.
Developers daily life has become pretty darn complicated.
Often real world complexity is handling problems like spikes in traffic, tracking down weird bugs in the logic, dealing with tricky concepts like concurrency, race conditions, or error handling, it’s writing complex business logic or even often just dealing with live UI updates on state changes elsewhere.
Just last year I was working on a project with alot of these characteristics, thinking this is what development is these days, your constantly hitting UI issues with things like how to handle ‘last’ in pagination with other users adding new records on a server render app. How to use thymeleaf and java with more modern javascript.
I was also trying out various new technologies like Strapi, and nuxt.js and was thinking wow these are great, so easy…. but then it happened... I discovered Elixir and the Phoenix Framework.
It started when I was listening to a dev podcast as I often do and heard a talk about Elixir (a wrapper/language for Erlang that runs of the Erlang VM …a thing called the beam), and some thing called the Phoenix Framework (Elixir’s web framework) and another thing in Phoenix called Liveview, that live updates the UI via channels (websockets) on server state changes. Described sort of like the react for the server, delivering a vastly simplified model for modern web development.
These were a completely unknown set of technologies to me, but I was intrigued, it sounded like it was addressing a-lot of my constant headaches with modern javascript, it offered a simpler model and would eradicate 90% of the js I’d recently written.
Now the weird thing with Elixir and Phoenix is the more you learn, the more you start to think, why is Elixir/Phoenix not the first choice for most businesses these days? It battle tested… after all its what powers WhatsApp and Discord.
It’s perhaps just too hard to express the list of all the amazing things you discover … Erlang was built to run telecoms switches, designed to never go down, to use message passing and concurrency. It has a concept of supervision, that will almost instantly recover your application into the last good state. Each piece make sense and makes you wonder how is this not taking web development by storm?
For instance Phoenix can update your client UI via websockets almost with no effort, its built as the fundamental way it works. Live subscribe to events so the UI just reacts to db changes and server events, using Pub sub. It has generators that just build whole web forms with all the crud actions, client side validation, db tables and migrations and autogenerated html form pages, even set up auth in just a few seconds.
Phoenix, Elixir and Erlang itself are all in one ecosystem, in fact the language of Phoenix is also elixir so your not context switching and as its functional the whole paradigm is essentially easier in the long run.
The Beam and OTP are designed to build rock solid concurrent systems that allow millions of erlang processes and millions of users to run simultaneously, with tools that eliminate the need for all sorts of other technologies like Redis, or test frameworks, and produces a system that can heal itself and keep running for years without issues...
You can also arbitrarily start building new websites with routing in phoenix just as easily as React or Vue, all with tests, build tools and less packages, and you quickly realise the whole thing is just simpler, more robust and just has less weird quirks. Plus the websites you build are just insanely fast.
It’s hard to express all the reasons why to learn a new language or tools, but for me it feels like I can breath again. It’s simply the most productive stack I’ve ever used. And I wish I could build more projects in it! Its a bit like having developer superpowers… and saves your sanity.