Refactor Toward GenServer Module Added To Elixir/OTP Course
September 06, 2017
At this point in our Elixir/OTP course, we see two types of code in our client-server interaction:
-
Application-specific code that applies only to our PledgeServer process
-
Common code that is needed for any server process
So what happens when we move all the common code into a generic module?
Well, we’re not the first ones to have that idea! In fact, writing stateful server processes is so common that Elixir provides an abstraction: GenServer. GenServer is a design pattern (an OTP behavior) that helps us write server processes with greater ease.

In this week’s new module #25 Refactoring Toward GenServer we refactor our code toward the GenServer style and by the end, you’ll have a deep understanding of how (and why!) it works.

Enjoy!