As you mark the beginning of your android development journey, it is important to familiarise yourself with the best practices. Android developers are fuelled by the ambition to create user-friendly platforms for people around the world that solve mundane problems. To make your mark in the development world, you must stick to the best practices – be it identifying the appropriate development method, having high code quality or having the most convenient and relevant app layout and configuration.
In this phase you’ll be learning about the best practices that we follow in android development.
Architecture
Rather than writing all the code in the activity, one should follow existing architectures in order to make the code cleaner and more organised.
- MVVM (Model-View-ViewModel) Most Commonly Used – This model is also known as model view binder and was developed by Microsoft architects Ken Cooper and John Gossman. It is used to structure and separate program logic and user interface controls.
- MVI (Model-View-Intent) – MVI architecture is Model View Intent and has been introduced only recently in Android. It is easy to debug, therefore, high on safety and helps track and record the flow of the data.
- MVC (Model-View-Controller) – This is the Model View Controller which helps to extend data and implement a variety of features. It improves code testability and is used to separate user functionality.
- MVP (Model-View-Presenter) – This is the Model View Presenter which is derived from the Model View Controller and is used extensively to build user interfaces. All the logic is transferred to the presenter mode.
Local Storage
In many cases we need to either store some data in form or database or key-value pair. One should know about the use cases of both and how it’s done.
- SQLite – This is a database engine which is developed in the C programming language. It is used to develop and manage embedded software in systems like televisions, phones etc. It is a library in C-language that software developers use in their application.
- RoomDB – RoomDB is similar to SQLite, except for one key difference- it has an abstraction layer that offers a more robust and rigorous database. One can save, update, read as well as delete data using RoomDB.
- SharedPreferences – Shared preferences APIs are usually used for smaller collections of key values. It is again mainly used as a storage platform. You can also retrieve simple values using SharedPreferences.
Navigation
The below-mentioned navigations can either be implemented by handling the fragment stack ourselves or the better way is Jetpack Navigation. Using Jetpack Navigation makes it much more convenient to handle all the cases in navigation.
- Bottom Navigation Bar – Using the bottom navigation bar, the user has visibility to all different screens and can shift easily from one fragment/screen. They enable movements in the app between primary destinations.
- Navigation Drawer – Navigation drawer allows the user to access the app’s primary navigation menu. It is a UI panel which pops up when the user touches the drawer icon in the application bar.
- Tab Navigation – The Tab Navigation bar is placed at the bottom of the screen. It allows the user to switch between various routes.
- Fragment + ViewPager – The ViewPager manages layout and allows the user to shift through pages of data. It is used extensively in apps like YouTube and Snapchat. It uses fragments instead of activities to assist the user in navigating the various layouts of the application.
Now, as you mark the end of this step, you can take pride in saying you are officially an Android Developer. Kudos to you for your awesome work and having the patience to stay engaged and survive till this part. Now you just have to brush up your skills and implement all that you have learnt so far in the company projects and be a valuable asset.