...

/

Making Our Server into a Component

Making Our Server into a Component

Understand how to split the server code into major components.

We'll cover the following...

Earlier, we said that what Elixir calls an application, most people would call a component or a service. That’s certainly what our sequence server is: a freestanding chunk of code that generates successive numbers.

Implementation

Our implementation puts three things into a single source file:

  • The API.
  • The logic of our service (adding one).
  • The implementation of that logic in a server.

Have another look at the code in the previous lesson. If we didn’t know what it did, how would we find out? Where’s the code that does the component’s logic? Imagine working with a really complex one with lots of logic. That’s why we’re experimenting with splitting the API, implementation, and server into three separate files.

We’ll put the API ...