Building an Android application is not a piece of Cake. It takes a good amount of time, investment, and commitment for a team to build an Android application. Furthermore – it’s not even a one-time investment. You will have to continue adding new features and put your significant efforts to make it user-friendly in the longer run.
Now, building an application is similar to building a house. Same as every house needs a solid structure, an application needs a good architecture to survive.
Table of Contents
History and Evolution of Android Architecture
Android has a long history of uncertainty towards Architectures. With MVC being used as the default architectural pattern, development used to be messy in Android. Literally, there were no guidelines on how to structure an android application back when Android was launched initially. All the code in Android used to be inside Activities and Fragments in Android.
Fortunately, as community members continue to get their hands on the platform, new architectural guidelines and a better way to write code emerged as a result. The separation of concern by Uncle Bob became a general principle for architecture apps in Android.
MVC became a history and new architectural patterns such as MVP and MVVM based on Uncle bob clean architecture were introduced in Android.
Furthermore, 2017 continue to add its mark in history when Google officially recommended an app architecture for Android using Architecture components. It is the collection of different libraries that provide developers a practical solution to write modular apps with lesser boilerplate code and building great experiences.
What should be the characteristics of a Good Architecture in Android?
Now that you had understood the Architectural evolution of Android, let’s delve into the five golden nuggets that complement an architectural pattern in Android:
Architecture should satisfy the multitude of Stakeholders
It’s a common thing to have a various multitude of Stakeholders and workers in a company. This includes developers, UX/ UI designers, DB engineer, QA etc. An architecture should be that feasible so that your code is organized in such a way that every stakeholder can work on the components they are supposed to work.
A good Architecture should better reinforce the separation of concerns
As mentioned previously, an architecture should adopt the principle of better separation of concerns or a single repository principle. The main idea behind the separation of concerns is that every component should have a single reason to change. That said, an architecture should be neatly separable by module level, package level, and class level.
A good Android architecture should be testable
A good architecture should be testable. MVP is such an architecture which is testable. By implementing the Passive View pattern in MVP, you can better make your app more testable. One major reason for this is that in MVP (Passive View), your Views are dumb. It is worth mentioning for that more dumber is your View, more testable will be your UI.
In case, if you are not able to unit-test everything then you must at least cover your business logic with tests.
A Good architecture should not relate to the Real world
The main concern for a good architecture is to emphasize more on the business logic without caring much about the data-source (Android, database, internet etc.) That said, all the nitty-gritty and dirty stuff that relates to the Real world should be remained hidden, let alone working of the framework under the hood.
In this article, we explained what does it mean by a Good architecture for Android. In case, you have any proper guidelines for how to create a proper Android workflow. Let us know in comments.