Mobile App Architecture Design
Ensuring you have a clearly-defined architecture is crucial for any software application, especially mobile. A well-defined mobile app architecture enables us to select the appropriate tools for fast feature delivery, and have a significant impact on the success of your mobile app. It can also ensure optimal performance, maintainability, and future-proofing for your application.
There are two types of mobile app architectures involved in building a mobile application - software and technical.
"It is not the beauty you should look at; it's the construction of the foundation that will stand the test of time." David Allen Coe
Software Architecture
This is the architecture or structure of your code and is integral to the efficiency of feature delivery, ongoing maintenance and the overall quality of your application.
You need to consider the following factors carefully:
- What language are we going to use?
- What frameworks are available?
- How will we deploy the app to my customers?
- How quickly can we get application updates to our customers?
Structuring your code
A common pattern for structuring your code is to use a three-tier architecture, splitting up the concerns of your application into separate, equally important layers.
Data Tier
This is where the data access code resides. The “data” in this tier doesn’t have to come from databases, for example, you may need to access the contents of a log file and be able to present those logs to the user. Having this tier means that the rest of the app does not need to be exposed to dependencies required for the data storage mechanisms.
Business Tier
This tier houses all your business logic and controls the application’s functionality by performing detailed processing, and will most-likely involve communicating with the data tier to extract the objects that this tier needs in order to perform a specific task.
Presentation Tier
This is the topmost level of the application. It pulls in the processed data from the business tier and displays it to the user. It’s worth noting that while this is the interaction point for the user, strong design of the lower tiers is critical to a good user experience and product design.
Best Practice Architecture
Each tier should enforce strict boundaries through the use of public APIs. For example, the business tier does not need to know about how the application handles access to the data. We should ensure that we are not directly accessing the data tier from the presentation tier. Enforcing this architecture improves the testability of our code, because we can test each tier to ensure that the correct data is coming out of your public APIs. It’s also important to remember that mobile connectivity is inconsistent, so you will have to consider scenarios where the mobile device suddenly loses connection.
Technical Architecture
In most cases, you are going to need an infrastructure to support your mobile app. The common building blocks required for a simple mobile app would be:
- An API
- A database
- An authentication provider
Infrastructure as Code
It is essential that there are no hidden surprises when you point your mobile application to each of your tiers, you need to ensure your environment is consistent. In Azure, you can document all of the resources required for your mobile app, in an ARM Template. This template allows you to deploy the environment in a repeatable, consistent manner. We recommend storing ARM templates in source control and running them through deployment pipelines. Following this methodology means you have an audit trail on changes made to your infrastructure.
Do you want to learn more about mobile app development and what makes a best in class mobile app? Download our free eBook CIO's Guide to Mobile Apps.