Adopting Elixir (Pragprog)

I have thought a couple times about, for lack of a better word, a “design patterns” book. There are data/functional patterns (enum vs stream, keywords vs maps, with), application patterns (facade, behaviours, protocols), concurrency patterns (cast vs call, async replies, genstage vs gen_event, ets, registry, task, async_stream), and fault tolerance patterns (supervisor, monitoring, signal trapping, etc).

The Adopting Elixir book explores some of those and goes deep into the “dirty schedulers and nifs vs ports vs… that whole mess” one.

14 Likes

My original plan for EiA was to discuss some medium-level concurrency patterns, and include a more involved real-world-like example inspired by a production system I worked on at the time. However, quite early in the game it became clear to me that my plan was way too ambitious :smiley:, and so I ditched patterns and the involved example.

I absolutely agree that a book which discusses various intermediate/advanced techniques would be very interesting, and that it would bring something to the table. I’d personally love a book which assumes that a reader is familiar with mechanics of Elixir/OTP/Phoenix (so it wastes no space on that), and instead it focuses more on applying various functional/concurrent techniques, explaining hows/whys along the way.

I also feel that there’s room for more than one such book. Perhaps it would be interesting to have a few shorter ones, e.g. one discussing functional techniques, another discussing concurrency/fault-tolerance, yet another focusing on troubleshooting production (basically Elixir in Anger), etc.

15 Likes

I’d personally love to see You write this book.

5 Likes

I really appreciate the vote of confidence, but I have to disappoint you that it’s not likely to happen. Though I really enjoyed writing EiA, I don’t see myself starting a whole new book anytime soon. So, as far as I’m concerned, these ideas are up for grabs :slight_smile: I personally hope that someone will give it a try!

6 Likes

I see this being repeated over and over again but what would you say is specifically the problem with deployment?

Calm down. :slight_smile:

The third part is made of three chapters and there is only chapter out. However, it isn’t a book about deployment and we felt like choosing how to deploy to Heroku or to EC2 would cover only one of the use cases and leave everyone else hanging, specially those not building web applications. So if that is what you expect, you will still be disappointed when the complete book is out.

In our experience, we have seen companies struggling with Elixir adoption before they even get to the deployment point. The book aims to smooth the adoption experience from the beginning of this process (development) to the end (production). Although it is safe to say that the deployment step is the next big “bottleneck” in the adoption process.

That brings me to the point that we have already started improving the deployment workflow further, especially with Dockyard hiring Paul to work on it full time, and we are also discussing on having releases built-in as part of Elixir.

Finally, I am sure there is a lot we can learn from other communities! In regards to Laravel, I would recommend you to raise those topics on the Phoenix guides or even send pull requests there. I assume those concerns are mostly specific to Phoenix and everyone can contribute as the Phoenix guides are open source.

8 Likes

Your post seems to be more a complaint about Elixir features than the book itself :confused:

If you want to discuss the state of Deployment tools then the thread we posted earlier is probably the best place to do so at the moment.

1 Like

That would be awesome. I hope you will continue to put some serious consideration into such a book.

3 Likes

Not to reanimate the dead here… in addition to covering what people typically refer to as “Design Patterns” (e.g. Gang of 4 patterns), I would love to see a discussion about overall architectural best practices. For instance, what is the best way to architect a larger scale multi-module application (Microservices? Deploying to a Kubernetes cluster, etc…)? How does one architect with scale and self healing in mind? What is the best way to approach multitenancy? Things like that. I think that would be a dang good read.
Being a DevOps Engineer myself- I would of course consider a discussion on deployments (how best to use Distillery), continuous delivery pipelines for Elixir projects (Deploying to containers, Linting with credo, Unit tests, all kinds of fun stuff that could be discussed here!) and other associated topics to be icing on the cake.

Sorry guys, I just looked in my beta copy of Adopting Elixir and see that a lot of the stuff I am suggesting here is already in that book (e.g. Credo and other DevOpsy topics), I’ll have to dive into that book next after I finish the one I am currently reading.

1 Like

You can get chapter three free from here: http://pages.plataformatec.com.br/chapter-three-adoption-stories :023:

1 Like

I would like to share my opinion after reading the biggest part of the book (I skipped Part III-Production since it is not a current concern for me).
A general comment is that it is very reader-friendly, explaining smoothly difficult concepts related to distributed systems in view of the Elixir ecosystem. It almost requires no coding, although trying some snippets will assist even more. The biggest part can be read even using Kindle in a bus, tram, walking, etc.
I should mention that in most cases, success stories are discussed analysing benefits of explored solutions in real life, demanding and deployed projects.
I especially enjoyed chapters 3, 5, 6 and 7.
Chapter 3 provides a list of very useful tools such as credo, dialyzer, inch, excoveralls, just to name a few.
Chapter 5 provides a sufficient introduction and discussion on core concepts such as processes, actors, GenServers, Supervisors, etc.
Chapter 6 is very important providing a comprehensive discussion on architectural aspects. I enjoyed in particular the analysis of the persistence strategies!
Chapter 7 provides significant information on deciding when to use Elixir and how to complement the weaknesses of the language with other languages, by providing a comparison of three approaches: NIF, Ports and the Erlang distribution protocol.
In my view, the knowledge in the aforementioned chapters should be obtained by every developer planning to use Elixir. I guess then that this forum will have less activity though since things will be much more clear. :slight_smile:

4 Likes

I just finished binge-reading Adopting Elixir by @bgmarx, @josevalim and @redrapids.

What an excellent and exceedingly practical book! It’s unlike any other programming language book I’ve read in the way that it approaches the subject. Very refreshing!

The first part of the book will help me when pitching Erlang and Elixir at work, to business people and developers alike. I’m preparing a company presentation as we speak.

As I’m still learning, some of the technical chapters were a bit too advanced for me, but it gave me a very good overview over the available tools, as well as when and how to use them.

My favourite chapters were the ones in part 3, about deployment, instrumentation, testing and debugging — Important and difficult topics which are usually left out of programming books. These chapters alone were worth the investment, although I also enjoyed most of the other chapters.

Now I know enough to feel a bit more confident about going into application development with Elixir; knowing where to go when I encounter performance- and operational challenges.

To the authors: Thank you for sharing your hard-earned knowledge.

2 Likes

I hope I’m not too late to the party, I’ve been reading this book for the past few days and I must confess my love for the book. Not sure how I missed this book since I purchased most of the pragprog elixir books.

IMHO providing guidance like this, is one of the many ways for a programming language to gain traction. I can’t resist suggesting to the community if a guideline section could be created with suggested resources for new entrants in the language ecosystem. I’ve an elixir app in production and wish I had read this book earlier.

Kudos to the authors and may I humbly ask if there will be a second edition. May I humbly ask again if there are any plans for an advance elixir book devoid of introductory material like declaring variables etc, maybe a book that focuses on things like elixir clustering, in-depth OTP, production ready code and patterns etc.

Thank you and stay safe.

3 Likes

It’s 2021, I was wondering if all parts of this book is still relevant especially considering the various evolutions that the language has gone through. I’m won’t consider myself an expert; I need expert advice on this front to proceed.

The book is broken in three parts, the first two (concept and development) are still relevant and up to date. The third part is slightly outdated, which is where Elixir and ecosystem have mostly solidified in the last years. It has three chapters:

  1. On the releases chapter, we talked about distillery but releases are now part of Elixir. Some specific instructions are now outdated but I would say though most of the lessons are still appropriate. You can close the gap by reading Elixir docs for releases

  2. On metrics and performance, we have unified around telemetry, so a good amount has changed. This is probably the most outdated chapter now but there are a lot of resources online too

  3. “Making your app production ready” is mostly up to date, maybe two or three links that would need to be updated

9 Likes