What is a USE CASE & Why do we need them ?
In MVVM, we use to put all our business logic into our ViewModels but the problem with that is, the bigger your project gets, the more number of ViewModels you have and all your business logic is divided into various viewModels. That’s where clean architecture comes into the picture, we use USE CASES instead of ViewModels for all our Business logic.
Use case is an action we can do within a feature. For example, We have feature called “Profile” which can have actions such as
- Getting user profile data
- Updating user profile photo
- Editing user profile All the above are USE CASES of a feature.
Unit tests added into data and domain module.
Testing your app is an integral part of the app development process. By running tests against your app consistently, you can verify your app's correctness, functional behavior, and usability before you release it publicly.
Testing also offers the following advantages:
- Rapid feedback on failures.
- Early failure detection in the development cycle.
- Safer code refactoring, allowing you to optimize code without worrying about regressions.
- Stable development velocity, helping you minimize technical debt.
- Minimum SDK level 21
- 100% Kotlin based
- Coroutines
- Android Architecture Components - Collection of libraries that help you design robust, testable, and maintainable apps.
- A single-activity architecture,
- using the Navigation component to manage fragment operations.
- Kotlin Flow Flows are built on top of coroutines and can provide multiple values. A flow is conceptually a stream of data that can be computed asynchronously. The emitted values must be of the same type
- Lifecycle - perform an action when lifecycle state changes
- ViewModel - Stores UI-related data that isn't destroyed on UI changes.
- Repository - Located in data layer that contains application data and business logic.
- ViewBinding - Generates a binding class for each XML layout file present in that module and allows you to more easily write code that interacts with views.
- Usecases - The domain layer is responsible for encapsulating complex business logic, or simple business logic that is reused by multiple ViewModels. This layer is optional because not all apps will have these requirements.
- Android Hilt - Dependency Injection Library
- Retrofit A type-safe HTTP client for Android and Java
- Modularization Modularization is a means of structuring your codebase in a way that improves maintainability and helps avoid these problems.
- Gson Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object
- Glide An image loading library for Android backed by Kotlin Coroutines. Glide supports fetching, decoding, and displaying video stills, images, and animated GIFs. Glide includes a flexible API that allows developers to plug in to almost any network stack.
- Material Design