You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why not have the ViewModel fetch data directly from a repository instance? (Aside from "because clean code says so", of course)
This is simply my preference.
From an Android developer's perspective, the MVVM + Repository architecture allows for writing less code. From an app user's perspective, the results are identical. From a product standpoint, Clean Architecture enables a clearer understanding of our business logic, making communication with non-technical stakeholders smoother.
In my past work experience, I've often needed to communicate with product managers, designers, and even marketing colleagues. They don't need to know the implementation details (usually in the repositoryImpl), but they do need to understand the use cases.
This is why, even if it means writing more code, I prefer using Clean Architecture.
Consider dropping the use cases and interface with the repositories directly
Removing the interface compromises the independence of unit tests. Interfaces allow us to use mocks or stubs, ensuring tests focus solely on the unit's logic without dependencies on external systems (See the dependencies). This keeps tests reliable, fast, and easy to diagnose.
Why not have the ViewModel fetch data directly from a repository instance? (Aside from "because clean code says so", of course)
The text was updated successfully, but these errors were encountered: