I started learning Elixir and Phoenix recently, and I’ve decided to bet the farm on this stack. Where possible, all my new projects will be written in Elixir / Phoenix rather than Rails. Here’s why:

  • Strong norm of “explicit is better than implicit”: the app boot process, middleware, assets, and other components of the request lifecycle are declared using a transparent and uniform “Plugs” metaphor, leaving me with a more confident understanding of how it all fits together, whereas the prevalence of “invisible defaults” in the Rails world can feel opaque and overly magical – this has been a pet peeve of mine for years.
  • Phoenix comes with some neat caching tricks that reportedly deliver requests several times faster than Rails with no manual effort by the app developer. For example, route matching and template rendering are precompiled down to efficient pattern-match functions and string concatenation.
  • Elixir’s functional paradigm provides some constraints that make it harder to end up with the “ball-of-mud architecture” that I often see Ruby & Rails projects grow into. For example, it’s easy to store most of your logic in input=>output functions that have no side effects, and it’s easier to spot side effects when they do appear. This in turn makes it easier to understand, maintain, and refactor going forward.
  • Phoenix (plus its Elixir dependencies such as the Ecto ORM) copies many of Rails’ best features, and has built-in support for conveniences such as live reloading, background jobs, and websockets integration; it feels like it was all designed to make the transition from Rails as easy as possible.
  • I love it and always will, but Rails is starting to show its age. I believe “convention over configuration” (compounded with the heavy use of OO class inheritance) has too often encouraged implicit and invisible “magic code” that impedes true understanding of the system and complicates troubleshooting & maintenance. Even ignoring questions of performance and real-time connection support, Elixir & Phoenix just feel like sturdier and more future-proof foundations to build web applications on.