Every android developers must know how to write code in best possible way. The main purpose of this blog is to create a simple app with architecture adherence, code quality, scalability with high testing code coverage. If you have basic knowledge in Android, then it should be sufficient for understanding.
This simple application can be helpful in understanding the necessity and implementing some of the best practices that need to be followed while developing an Android application.
For this we picked up the most common features in major apps and code that in the best possible way.
Audience: To understand this blog, basic Kotlin and android experience is necessary.
Topics covered in this app for best practices and basic knowledge required to be among top Android developers.
- General do’s and don’ts – Do’s and Don’ts
- MVVM architecture pattern – MVVM architecture
- Dependency injection – Dependency Injection
- Testing – For detailed information check out this blog. - Testing
- Accessibility – For more information check out this blog – Accessibility
- Dark and light theme – For more information check out this blog – Dark theme
- Kotlin coroutines – Kotlin coroutines
If you have checked the above topics lets create an application with applying the best practices.
What are the functionalities this app covers ?
This application covers the basic login flow, Listing products and their respective detail screen, screen orientation and different screen sizes. We plan to keep adding the most commonly used functionalities with the best possible code. 🚀
Do let us know if we can improve in any way!
Here is what we will create:
Before we start creating UI and writing code we need to decide the folder structure and the architecture pattern we are going to follow.
Folder structure :
This is important as the app grows gradually with increase in team size and becomes difficult to keep track of the activity/fragments and their related files like viewmodels, adapters, and interfaces.
Everyone follows their own folder structure based on the application size, which can be convenient in its own way. I prefer to use this folder structure.
Architecture pattern :
In this application we are going to use the recommended MVVM architecture pattern along with the jetpack architecture components.
Checkout our blog on MVVM architecture pattern to know more in detail.
For more info check out the official doc on app architecture – https://developer.android.com/jetpack/guide
Let’s split our requirements into features and see each in detail in a separate blog.
Feature modules :
- Part 1 – Feature development => Login
- Part 2 – Testing => Login testing
- Product listing and detail
- Part 1 – Product listing and detail => Product listing and detail screen
- Part 2 – Testing => Product listing and detail testing
In each blog we will use jetpack architecture, Dependency injection and write test cases for the classes.
Hope these blogs helped you in creating an application with best practices.