Architecture patterns for Apps
Architecture patterns for building apps
Abstract
When researching architecture patterns to I encounter a lot of information that turns to be confusing and even more when comparing and switching between platforms, this note aims to give clarification in this regard.
What are Architecture Patterns
An app has to be planned, and architecture patterns help with that planning process, they are commonly used solutions or approaches for designing the structure and organisation of software.
They provide guidelines and best practices that allow the creation of scalable, maintainable and robust applications.
You can have multiple Architecture patterns in a project, this can be within the same layer or different ones
Core Principles
Separation of concerns
Single source of truth
Unidirectional Data Flow
Drive UI from data models
If you base your app architecture on data model classes, you make your app more testable and robust.
Most know architecture patterns
Before we dive into the architecture patterns I'd like to categorise them based on the areas they focus on and I believe that Clean Architecture makes the separation very easy to understand by having presentation, data and domain layers .
So instead of a full list of architecture patterns I will give you a list of architectures for each layer and how they can interact with each other.
The UI Layer
The Data layer
The Domain layer
The domain layer just contains pure-logic and no architecture pattern should be necessary as the class is not tided to the app's lifecycle or framework, but here are some recommendations when you need to implement them.
-
Multiple sources: If your app uses local and remote resources and you have to make operations on top of them i.e get the newest or merge objects, this is a place where a Domain Layer can help you. A
useCase
might be of help for you and if the data model is different you can create a commonmodel
for your dataSources. -
Joining Repositories: If you need to inject multiple repositories and perform repetitive operations on them to join them in your UI layer (such as ViewModel), consider creating a separate
repository
that handles the joining of those two repositories.
Relates to
Architecture Patterns for Building WebApps
References
https://medium.com/@pinarkocak/mvc-mvp-and-mvvm-design-patterns-82317d6efeac
https://www.linkedin.com/pulse/mvvm-flux-back-again-andrei-fangli
https://medium.com/@pinarkocak/understanding-viper-pattern-619fa9a0b1f1