AstonJ

AstonJ

Functional Web Development with Elixir, OTP, and Phoenix (Pragprog)

by Lance Halvorsen

Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web applications. Make the most of them as you build a stateful web app with Elixir and OTP. Model domain entities without an ORM or a database. Manage server state and keep your code clean with OTP Behaviours. Layer on a Phoenix web interface without coupling it to the business logic. Open doors to powerful new techniques that will get you thinking about web development in fundamentally new ways.


Don’t forget you can get 35% off the ebook using the code ‘devtalk.com:023:

Can’t wait :003:

460 27863 124

Most Liked

redrapids

redrapids

Author of Adopting Elixir

This is a very good post. This is why I love the Elixir community.

Lance and I are working with some great reviewers to make sure we address this feedback. We’re going to shift the approach for the two chapters in question, the chapter on modeling and the chapter on wrapping the result in OTP.

As a popular book in the community, we want to make sure that the guidance we give is sound.

Thanks again for a great post.

lance

lance

Author of Functional Web Development with Elixir, OTP, and Phoenix

Thanks for the hat-tip! I’m beyond excited for the beta launch. :grinning:

17
Post #2
mjadczak

mjadczak

I grabbed the book and had a (virtual) leaf through, and I would have two main comments:

First, perhaps I didn’t read the book page properly, but I had the impression going in that this was going to be much more advanced than it was. The PragProg page shows the skill level as “intermediate to expert”, and while I agree that it is not a beginner book, I would not call it expert-level either. By “have previous experience with Phoenix and Elixir” I took “have built complete, if maybe simple, applications with them” rather than “know how the syntax works and how a Phoenix interface is structured”. I think clarifying exactly the target audience of the book may be beneficial.

Second, I take issue with the way that the entire game state is represented in a bunch of processes referring to each other by holding PIDs. I think the best way to say what I mean is to simply refer to this great article by Saša Jurić. The way this is implemented in the book smells really strongly of trying to make Agents behave like objects, which is a common mistake for those moving over from OOP, but should in fact be explicitly called out in a book like this, instead of impliedly encouraged.

I think at a certain point you mentioned that “trying to store the whole game state in a functional tree structure is a recipe for bugs because coordinates can belong to both islands and board and we’d have to update them in both places”. The answer to that problem is to normalise the way you’re storing the coordinate data, so you’re only storing it once. It’s certainly not to make each little piece of your state be a separate process!

As has been discussed many times over on this forum, separate processes should be used when a separate concern, either separate in time or separate in failure domain, is present.

Further, what happens when these processes die? They are all linked it seems, so one failure will take down the entire system. If you insist on using them to model the state, perhaps it is at least an opportune time to put them into a custom Supervisor and use Registry to register them with the coordinate/board they represent?

I’m sure it is not the intention of the book to do so, but while I applaud the decoupled, “Phoenix is not your app” approach, I feel it either itself falls or encourages people to fall into common traps when structuring Elixir apps and modelling their domains therein.

I don’t mean to be too negative—I think the concept of the book is great, and a practical walkthrough of how to build something fun but useful is a great way to convey the concepts, but I also think it’s crucial that the approaches set by the book are 100% defensible (to avoid saying “right”) and push people towards actually using the great many tools Elixir gives us in the way they were designed to be used.

Where Next?

Popular in Books Top

AstonJ
by Saša Jurić Elixir in Action teaches you to apply the new Elixir programming language to practical problems associated with scalabilit...
New
PragmaticBookshelf
Alexander Koutmos Bruce A. Tate @redrapids Frank Hunleth @fhunleth edited by Jacquelyn Carter @jkcarter The Elixir programming langua...
New
PragmaticBookshelf
Bruce Tate @redrapids edited by Jacquelyn Carter @jkcarter OTP is the heart of the rapidly growing Elixir, the functional language at th...
New
shankardevy
I am happy to announce that I am completing final rounds of my Phoenix book (which is now a series of books/booklets). ...
New
AstonJ
by Dave Thomas This book is the introduction to Elixir for experienced programmers, completely updated for Elixir 1.6 and beyond. Explor...
New
AstonJ
by by Fred Hebert Erlang is the language of choice for programmers who want to write robust, concurrent applications, but its strange ...
New
PragmaticBookshelf
Peter Ullrich (@PJUllrich) edited by Michael Swaine @michaelswaine Data is at the core of every business, but it is useless if nobody ca...
New
PragmaticBookshelf
Rebecca Le and Zach Daniel @zachdaniel _edited by Kelly Lee @k.lee _ Ash Framework is the game-changing toolkit for Elixir developers. W...
New
tristan
Adopting Erlang is a collaborative effort between myself (Tristan), Fred Hebert and Evan Vigil-McClanahan. It is an ongoing effort to gat...
New
peerreynders
Don’t forget you can get 35% off the ebook with your forum discount, use code ‘devtalk.com’ :023: Available in beta now
New

Other popular topics Top

AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New

We're in Beta

About us Mission Statement