Establish Your Boundaries
The boundary layer deals with side effects and state. This layer is where you’ll deal with processes, and where you’ll present your API to the outside world. In Elixir, that means OTP.
We want to dispel the notion that each time you type mix new, you must reach for a GenServer, the fundamental abstraction in OTP. The first way to win the boundary game is not to play. Some projects don’t need boundary layers at all. If you’re building a library of functions that doesn’t need processes, don’t add them. Your code is a library and can present an API that serves your purposes just fine. There’s no boundary; no GenServer; no lifecycle. Your library will serve other software systems that provide this infrastructure, but it ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access