There has been a lot of buzz about Android Architecture components lately. These are a part of Android Jetpack, announced in Google I/O 2017. Why shouldn’t there be? Ah! it deserves it.
It has come up addressing a lot of issues and making Android Application Development easier after all. So let us first understand the issues it addresses and then have an overview of what it is comprised of.
Why Android Architecture Components?
An android app usually has some activities, fragments, a database, helper classes, adapters, uses a number of libraries and frameworks. It might seem simple to the user in the frontend, but when looking at the codes, it is very complex with a lot of classes handling the tasks and thus making it complex. Now let’s say the app is somehow built. What about maintaining it, extending it, testing it?
Maintenance implies resolving issues if there comes any. You might come across situations when the app crashes and you need to find out the bug, making sure it gets resolves now and doesn’t come up again and again. Extending implies adding new features to your product. You might want to add new functionalities to your app with time, without affecting the existing ones. Or you might want to update the existing functionalities without losing the existing data. Testing implies you test each feature of your app independently and improve the codes for it without having to change the other codes. Mind-boggling right?
To get all this in your product, you need to follow some architectural pattern such that each part of your product is independent yet works coherently with other components. And this is applicable for any software that you start building, not only android. There have been some common architectural patterns out like MVC(Model View Controller), MVP(Model View Presenter) and MVVM(Model View ViewModel). Each of them has their respective pros and cons. So you need to plan your architecture and then start working on it.
However, Google has now provided us with the Android Architecture Components(AAC) that fulfils all our requirements to make our app robust, maintainable, expandable and testable. This makes AAC important to learn and understand. Let us now see what it is exactly.
What are Android Architecture Components?
AAC as already mentioned, are a part of Android Jetpack. Android Jetpack is a collection of libraries that make android application development easy by:
- reducing the boilerplate code
- helping us follow the best practices
Now, this picture above shows the complete Android Jetpack, of which AAC is a part. So we will be learning all the AAC components in this series, which includes:
- Lifecycle-aware Components