CLEAN-4: Each architectural layer should possess its own data model


Description

By implementing a data model at every layer, a high degree of decoupling between layers can be achieved. Specifically, by following this guideline, the outer layers of apps can be implemented without any explicit knowledge of the implementation details of the inner layers. This means that the origin of the data becomes transparent to the client and hence, in a repository pattern fashion, data sources can be added, removed, or changed without much effort.

Example

We created a simple MVP login Application.

Login depicted

Each layer works with its own model. The View layer works with the Presenter. The Presenter works with the Model. If we change the way we store the data from the model, the View would not need to know. Since the View receives the same data.

Check out the Github page to view the complete repository.