First impressions of Elixir as a JS developer
Elixir is a functional programming language which runs on the Erlang VM, it’s touted as being “designed for building scalable and maintainable applications” and if you squint, it has a very Ruby-esque syntax on the surface. Elixir is easy to get started and what’s included out of the box makes it one of the most accessible programming languages I’ve ever worked with. The tools included by default are great and make for a very good developer experience. So what are these tools and what sets them apart?
Elixir ships with IEx, much like IRB for Ruby but it has some more advanced features. IEx is indispensable when developing. Running your project with:
iex -S mix
Allows you to recompile modules without leaving iex:
iex(1)> r MyModule
A REPL is a nice way to try something out quickly without leaving the terminal.
Documentation is a first-class citizen in Elixir. It’s a pleasure to write and ExDoc generates a great looking static site. You can attach documentation for modules and functions like you would in most languages but there are some really cool additions. All documentation can include markdown which will render in the resulting web page and is non-intrusive.
One of my favourite features is Doctests, if you include the title “Examples” in a test along with some sample code and the example will run during testing.
If you want to give Elixir a try, I hope this article has convinced you that the barrier to entry is really low. It’s got everything you need to get started and hit the ground running. You can toy around in it using the REPL (IEx) or learn how to get creating quickly with the helpful Elixir guides. Overall the documentation is really helpful and consistent, because of the focus on documentation from the beginning, most modules you find for Elixir should have enough to get started along with some example code to boot.
If you’re curious about Elixir’s syntax, I always recommend Learn X in Y minutes. It’s a helpful cheat-sheet:
Thanks for taking the time to see why I think Elixir is a cool ecosystem to get started in and be productive from the outset. Let me know what you’re experience is with Elixir and if you’re just dipping your toe in the water too, how easy is it to get started?
Background photo by Martin Sanchez on Unsplash