Working with Contexts
Phoenix 1.3 introduced the idea of contexts to the Elixir community. The Phoenix team was inspired by the concept of “bounded contexts” as described by Eric Evans in his book Domain-Driven Design. This pattern suggested a new way of structuring applications, and the team updated Phoenix’s generators so that contexts became the default behavior.
With contexts, we can group related functionality. A context consists of a single main module, usually referred to as the context module, and, optionally, a directory with more modules that help implement the functionality of the context. A context may have many modules or just one, but in either case, the context module contains the external interface of the context.
This is not ...
Get Programming Ecto 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.