Data models, contexts and modular design are all part of an Elixir/Phoenix application's architecture. Learn how to build and handle them with the third part of our tutorial!
Welcome to the third part of the article series about creating an uptime monitor in Elixir. Today we will build the data models in our application. It is going to be a bit of a challenge because of the task touching the application architecture field.
Taking it back to the first article, we want our application to be a tool where you put your website URL and it will gather its uptime and response time. The uptime will be shown with a given accuracy, depending on the chosen timespan. The same goes for the response time.
Contexts in Elixir are the modules exposing and grouping related functionalities. Any time you call any standard library function, like Enum.map/2, you refer to some context.
Modular design is a design pattern, where you split the whole system into smaller, independent parts grouping some functionality. They are called modules. Those, in the perfect scenario, can be independently replaced and exchanged between systems. Modular design is a wide concept, related not only to programming but to the whole engineering in general.