The Alchemist's Guide To OTP

The Alchemist's Guide To OTP

A field manual for Elixir programmers

About the Book

I’ve been using Elixir for projects since sometime around 2012-2013, and the one thing that I always wanted was the programming equivalent of a field manual - a handbook intended for use while practicing your craft; concise, visual, and practical. I wanted it oriented around examples which were non-trivial, which would enable you to understand the tools at your disposal in a context closer to reality. This book is my take on what that looks like.

The Alchemist’s Guide to OTP is intended for Elixir programmers who are already somewhat comfortable with the language, and have a basic grasp of OTP concepts (i.e. applications, supervisors, etc.); this provides us room for looking at these concepts in detail, going all the way down to how they work internally. The book also covers a number of topics which are tangential to OTP, but which are an important element in the structure and design of efficient Elixir systems.

The book uses an application, Autofactory, to keep the topics grounded in a real project. The full source code of this application is included with the book, and is intended to be extended and experimented with for putting the patterns and ideas in this book to practice. Autofactory is a simulated manufacturing facility, which receives orders via API, and simulates the entire manufacturing process in detail. This provides us a practical foundation for discussing concepts like flow control, load shedding, circuit breakers and more, with just enough complexity to illustrate the issues and their solutions.

Some of the topics covered:

  • Designing applications by examining the problem domain and how it breaks down into concepts which map well to Elixir architectural patterns
  • How to determine application boundaries
  • How to design modular applications by building against protocols/behaviours, abstracting implementations from interfaces, and injecting implementations via configuration rather than directly calling them
  • Investigating OTP primitives in detail (applications, supervisors, special processes, etc.), including common pitfalls and how to avoid them
  • Effective use of finite state machines (via GenStateMachine)
  • Effective use of macros for reducing boilerplate without going "macro crazy"
  • Flow control, load shedding, circuit breakers
  • A variety of architectural patterns both large and small ("process as message", error kernels, stacking theory, etc.)
  • Everything about releases: configuration, migrations, hot upgrades, appups
  • Operations: troubleshooting in production, tracing and debugging tools, metrics, alarms
  • Writing efficient Elixir programs
  • Share this book

  • Categories

    • DevOps
    • Functional Programming
    • Computers and Programming
    • Software Engineering
  • Feedback

    Email the Author(s)

About the Author

Paul Schoenfelder
Paul Schoenfelder

I'm a software engineer passionate about open source. I'm heavily involved in the Elixir/Erlang community, have contributed to both languages and am the author and maintainer of Distillery, as well as a number of other libraries.

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub