Elixir course

Elixir Level 4: Data Modelling

Data Modelling is level 4 of 16 of the LoWisa Elixir course. It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

Updated 2026-11-25

Structs

  • Structs. A struct is a named map with declared keys: %Order{}: typos caught at compile time.
  • Defaults and enforcement. Structs declare defaults and enforced keys: objects born valid or not at all.
  • Updating structs. Update syntax rebuilds: %{order | status: :paid}: new value, old one unchanged.

Protocols

  • Protocols. A protocol dispatches by data type: String.Chars, Enumerable: polymorphism for data.
  • Implementations. defimpl implements a protocol per struct: your types joining the ecosystem’s verbs.
  • Protocols versus behaviours. Protocols dispatch on data; behaviours contract modules: two polymorphisms, two jobs.

Behaviours

  • Behaviours. A behaviour declares callbacks a module must export: the compile-checked module contract.
  • Callbacks. @callback specs document each required function: types included.
  • Swappable modules. Behaviours make modules swappable: the real adapter in prod, a fake in tests, one contract.

Before and after this level

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.

Frequently asked questions

What does Elixir Level 4: Data Modelling cover?

Structs, Protocols, Behaviours: 3 lessons and 9 ideas.

What should I know before this level?

The level before it, Level 3: Functional Design, which covers Pipelines, Higher-Order Functions, Recursion and Transformation.

Learn Elixir on your phone

The first level is free. LoWisa is on Google Play and the App Store.