...

/

Identifying the Data of Our Project

Identifying the Data of Our Project

Let’s define the fields that will be present in the templates and questions of our quiz.

Creating our core

We’ll create a lib/mastery/core directory to hold the modules with our data layer (and later our core functions).

Defining a template

We’re going to use the primary Elixir data structure, the map. We know that the fields will be a struct. The centerpiece of our quiz is the template. The fields in our templates will serve three purposes—description, question generation, and checking responses.

Description

Our first three fields will describe our templates. As such, we’ll have a name and a category, which we’ll represent as atoms. We’ll also have an instruction to tell users what to do as they answer ...