Wrap the Server in an API

The API layer’s job is to insulate the server layer from inconsistent data and to stitch together independent concepts from the individual GenServer implementations. It will also hide internal implementations from the user, such as the Quiz struct we make available from our QuizManager server. Any implementation details from server layers or the functional cores will be off limits.

Though our internal details may be radically different, the API-wrapped server will share many characteristics of an OOP object. It will hide implementation details, including state, behind an API of functions. It will allow complex interactions between components with message passing, and will allow convenient state tracking.

Before we ...

Get Designing Elixir Systems With OTP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.