About this project:
1- Kotlin
2- MVVM
3- LiveData
4- ViewModel
5- Hilt DI
6- Repository pattern
7- Navigation component
8- Data Binding
9- Room DB
10- Coroutines
11- Unit testing (local tests + instrumented tests)
RecyclerView vs Listview
- In RecyclerView, it is mandatory to use ViewHolder pattern Which optimize the performance.
- DiffUtil callback Which optimize the performance.
- There is no official way to implement a horizontal ListView. But in RecyclerView by using Layout Manager you can do vertical, Staggered or Gridlayout
Activities vs Fragments
- I have used a single-activity architecture which allowed me to take full advantage of the Navigation component, which mean that a single activity that manages and host multiple fragments.
- The fragment is more lite weight than Activity.
ViewModel vs AndroidViewModel
AndroidViewModel is a Application context aware ViewModel. As I didn't need to use context inside my ViewModel classes, I've used ViewModel.
Unit test vs instrumented test
In cases where I wanted to test the behavior of some screens in a real device I used instrumented test by Espresso and Mockito. In the functions I didn't need a physical device I used the local Unit Tests.
Hilt vs Dagger2 vs Koin
- Hilt does not need factories for ViewModel , Dagger need
- Hilt generate the code in the compile time , koin runtime generation code