Search⌘ K
AI Features

Define the Functional Core in Elixir

Explore how to define the functional core of an Elixir application by focusing on pure data structures and functions. This lesson helps you gain clarity and simplicity by postponing the use of frameworks and databases, enabling a clean separation between business logic and interfaces. You'll understand why starting with a functional core strengthens your application's foundation.

Let’s begin

In this first part, we build all the logic for our game in a new Elixir project. We define the data and behavior that determines the essence of our application. We’ll do this in sequential Elixir, with only modules and functions.

There is a powerful opportunity at the beginning of a new application. We’ve got ideas about what we want to build, but we haven’t opened a terminal window or a text editor. The application is all potential and none of it is actualized yet.

This is the perfect place to examine our habitual approaches and choose new paths. The decisions we make here will shape the rest of the project in fundamental ways.

The path we’ll take is likely to be quite different from any we’re used to. However, it will simplify and clarify our code. It will build a foundation from which the rest of the application can grow. As web developers, we typically begin a new project by running a command in our favorite framework to generate a new application we can customize. We also think about how to persist the application state between ...