Which Elixir books should I read?

September 24th, 2015

tl;dr: Programming Elixir then Elixir in Action. Skip Programming Elixir if you’re already familiar with functional languages, pattern matching, etc.

Elixir has some great books for such a relatively new language. This post is a mini review of the ones I’ve read and what I’d recommend you read if you’ve limited time/budget.

Elixir is built on top of Erlang so I’ve read some Erlang books too. I’ll mention the ones that delve deeper into OTP that will be of interest once you’re happy with your Elixir skills.

Programming Elixir

This is a great place to start for those who don’t know functional programming, particularly if you arrived to Elixir via Phoenix and want to understand the language better. It covers everything so you’ll learn all the concepts and have a good base for exploring further.

The first part of the book gets introduces you to general Elixir programming with pattern matching, recursion, immutability, and the Elixir build tool mix. The second introduces concurrency, distribution, and OTP. The final part covers more advanced topics like macros and protocols.

Once you’ve been through the book you’ll be well placed to dive deeper into OTP, Macros, etc. with the more specialized books that are available. I’d highly recommend doing the exercises as you go through the book to really get your brain thinking in a functional way.

Elixir In Action

If you already know a language with pattern matching, immutable data structures etc. you might skip Programming Elixir and start with this book. If you’ve just finished Progamming Elixir and want to learn more it’s the next step.

The book is more focused on using Elixir to leverage what’s available in Erlang/OTP than the language itself. It goes into nice detail about how the underlying system works and it’s strengths and weaknesses. It’s worth reading the first chapter and skimming the next three even if you’ve just finished Programming Elixir.

One of the things I like about this book is it develops a sample app over several chapters while introducting you to different concepts. This helps you learn how to start thinking about how to program using OTP in Elixir and gives you some useful patterns to use in your own code.

It has space to go into more depth about supervisors, the BEAM, and libraries that are available as part of standard Erlang distribution than Programming Elixir. Once you’ve finished this book you should have a good understanding of how to think in terms of processes and how to structure your program in terms of what needs to happen concurrently and sequentially.

Erlang and OTP in Action

Elixir in Action wasn’t out when I finished Programming Elixir so I decided to get this book and work throught it translating the examples into Elixir. It’s the oldest of the books I’m reviewing here but that’s not as relevant as it might be in other languages given how long Erlang has been around and how stable OTP is as a platform.

Like Elixir in Action this goes into details about the BEAM and builds up a distributed application over several chapters as it teaches you various concepts. It also covers using mnesia and of course how to think about decomposing your problem to match Erlang’s strengths.

Going through the book and translating it to Elixir helps immensibly with being able to read Erlang code. As Elixir is built on top of Erlang this is a good skill to develop. You will probably be fine with just Elixir in Action but if you want another explanation of OTP this book could work. However Designing for Scalability with Erlang/OTP which I’ll write about next might be a better bet.

Designing for Scalability with Erlang/OTP

This book isn’t quite released yet, it’s almost complete though so still worth picking up the early access edition. It delves deeply into OTP and the principles behind why it works the way it does. I must admit I haven’t read it as carefully as I have the previous books as I’ve been waiting for it to be finished.

It has more detail than the books above and covers areas they don’t such as tracing, implementing your OTP compatible behaviours, and generating releases and upgrades.

This is the book to read once you’ve finished Elixir in Action and want to go deeper still into the thinking and concepts behind OTP.

Erlang in Anger

This is a free book written by lead of Heroku’s routing team, Fred Hebert, who also wrote Learn You Some Erlang for Great Good. He obviously knows a lot about dealing with lots of connections, data, and handling system failure so this book is at least worth skimming before you put your first code into production.

It covers how to understand the parts of an Erlang code base, how to plan for overload, where systems commonly fail first, and tools and techniques useful for monitoring and debugging live systems.

All of these are Erlang tools but they’re accessible to you from Elixir and definitely worth playing with.

Metaprogramming Elixir

Macros are one of the features of Elixir a lot of people find interesting and Chris McCord covers them in depth in this books. It takes you from understanding how the Elixir AST work to building macros that perform complex tasks.

It has great advice on what to do and more importantly what not to do when you’re thinking of using macros. Once you’ve worked through it you should be able to write the least amount of macro code for the greatest effect.

Books I haven’t read

Études for Elixir

This book contains exercises that teach you how to write code in a functional way and also covers working with processes and a little OTP. If you want some extra homework after Programming Elixir this is the place to go, especially as it’s freely available.

The Little Elixir & OTP Guidebook

This book isn’t finished yet, and having read all of the books above I’m not sure when I’ll get to it. It’s available as a MEAP so if you get it let me know in the comments what you think.

Introducing Elixir

This is another introductory book, along the lines of Programming Elixir. Again I haven’t read it so if you have please comment below.

Conclusion

I hope this has helped you decide what books will be useful to you. Don’t forget about the excellent Getting Started guide. If you’d like to practice as well as contribute look out for issues tagged Level:Starter in the Elixir repo.