Mobile architecture is a roadmap of how the mobile app is built and consists of various rules and techniques. A well thought out mobile architecture can allow for rapid development of the app features by following industry standards and ensures scalable, maintainable and high-quality end product.
At a basic level mobile app architecture consists of three layers: Presentation, Business and Data.
Presentation layer consists of UI components, user interfaces which is responsible for the look and feel of the app. It is responsible for user experience which provides end users way to interact with the app by utilizing buttons, links, video, images, etc. Presentation layer is highly influenced by product’s branding guidelines and strategy.
Business layer is responsible for converting the data in a way that is meaningful to the end user. It consists of processes and rules related to data operations, caching, validation, logging, error and exception handling, etc. Business layer can be on user’s device, on the server or on both depending the requirements.
Data layer is responsible for managing data access and transactions. This layer can be further divided into two layers: Repository and Network. Repository layer is responsible for sourcing data via API interfaces and implementing local persistence strategy if required. Network layer is responsible for providing routing of the APIs via network communication and handling network errors.
The right mobile architecture can help solve many mobile development challenges and can lead to scalable and maintainable mobile application. These architectures allow for separation of responsibilities and increases modularity, flexibility, testability and maintainability. Below are widely used mobile app architecture patterns that can help to solve the challenges that come with app development.
MVC is one of the most familiar architecture approaches. It separates mobile app in three layers with their separate responsibilities. View is responsible for rendering UI elements and observing model for any data changes. There could be multiple view that can be mapped to the Controller. Controller handles user actions and processes data thru Model and updates the UI based on model. Model manages the data manipulation based on the business rules.
MVP is similar to MVC. It replaces Controller with Presenter. View is responsible for rendering UI elements and observing model for any data changes. View has one to one mapping with the presenter. Presenter handles user actions and processes data thru Model and updates the UI based on model. Model manages the data manipulation based on the business rules. Compare to MVC, Model and View don’t interact directly in MVP allowing for better decoupling.
MVVM is relatively new approach for the mobile architecture. In this Model and View behave much of the same way as MVC and MVP. Multiple views can be mapped to the ViewModel. MVVM handles user actions and processes data thru Model, however data flow from Model to ViewModel and ViewModel to View is handled by observers and provides greater decoupling compare to MVC and MVP.
Viper is relatively new architecture pattern mainly used for iOS app development. It provides greater separation of responsibility compare to MVC which widely used for iOS apps. In this architecture, View is responsible for rendering UI elements. Presenter handles UI input, and holds the UI logic and triggering UI changes. Interactor contains the business logic. Router is responsible for navigation and Entity is responsible for managing data object used by interactors.
Recommended Architecture — MVVM, VIPER
Mobile architectures are constantly evolving. The key to selecting mobile architectures requires us to consider following important criteria.
App components should be easy to modify to allow for bug fixes and performance enhancements. It should allow for quick implementation of changes to support any new enhancements to support new platform features or business requirements
Various app components within the app architecture should be easy to test individually which can lead to reduced number of bugs and better reliability.
App architecture should be modular and should support reusability of the various components for faster feature developments and any future redesign.
App architecture should be robust and should be able to secure user data
App architecture should be scalable so that it can support parallel development of the various features
Keeping the above criteria in mind, two architectures really stand out: MVVM and Viper. MVVM can very easily be adopted for Android because of the out of box support with the ViewModel component. Viper is widely used for iOS app development Viper and takes separation of concern one step further than MVVM. These are both great choices. MVVM with a bit of a less separation of concern can reduce the overhead, however Viper will provide better testability because of higher separation of concern.
We use analytics to understand the usage, to improve user experience and to measure the performance of our website. We anonymise any information we may collate so we can’t identify you personally.