Elixir – A More Complete Toolbelt

— 3 minute read

I'm gonna be honest. I like JavaScript. It's approachable, it's (fairly) capable, it's everywhere... but when it comes to building real-world applications, a key piece of the puzzle that JavaScript gets wrong is the lack of a decent starting point.

An Incomplete Starting Point permalink

Building even a simple, yet complete app in a language like JavaScript is like sitting down at a workbench to build something, and then you need a hammer. But you realize you've only got a screwdriver. So... you've gotta get up and either grab it from the shelf (if you've already chosen/bought the hammer) or you have to go to the store and buy a hammer.

JavaScript doesn't include much beyond the basics of the language, has a limited standard library, etc. So to actually build things with JS, you end up having to either build out utilities/tools yourself or (the more typical option in JS-world) go and find a package somewhere on npm.

Fortunately for you, your tool store expands outside of JavaScript packages and into the world of "DevOps". From here you can find a vast array of services to tack onto your little app.

  • Need to run parallel tasks? Go serverless.
  • Caching? Try Redis.
  • Messaging? We've got a service for that, too.

By the time you're done shopping for services, you've got a good 'ol distributed system spread across all of these services. Welcome to a set of new problems that you didn't experience with your simple little app on its own.

Enter Elixir permalink

Elixir is a hot new-ish contender in the (so hot right now) functional programming space. It's like if you could run the syntax of Ruby on top of the battle-tested reliability of the Erlang runtime (the BEAM). With the Erlang runtime, you get so many tools built in for free.

The following chart really shows the difference in tool-choosing that you end up with (hat-tip to Saša Jurić's book Elixir in Action for this).

Comparison of technologies used in two real-life web servers (from Saša Jurić's Elixir in Action).
Comparison of technologies used in two real-life web servers (from Saša Jurić's Elixir in Action).

I'm very new to Elixir, at least in actually building things with it. But from the perspective of someone who gets distracted easily (like most of us, right?), I think having the opportunity to sit down with a suite of tools within arms reach instead of having to go shop around as I need them... I think that can only be a good thing.