Open Deep21 opened 7 years ago
The way I think about it is that User
is a dto (data transfer object), should be a simple pojo, it will responsible for passing info back and forward between my app and an external service like a database or an api.
UserModel
on the other hand will contain some presentation logic, manipulate the raw User
data to be presentable and consumed by the View layer, lately I use bindings between this models and the views.
it's for separating the modules for a testability perspective making the system decoupled, and as @android10 mentioned in his blog post
It is worth mentioning that each layer uses its own data model so this independence can be reached (you will see in code that a data mapper is needed in order to accomplish data transformation, a price to be paid if you do not want to cross the use of your models over the entire application).
thank you
Thank you, great job.
2017-03-30 21:37 GMT+03:00 Deep21 notifications@github.com:
thank you
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/android10/Android-CleanArchitecture/issues/228#issuecomment-290504849, or mute the thread https://github.com/notifications/unsubscribe-auth/ALdsRH1DNrV-tSmVCIqb4pJoHmyJCnNLks5rq_Z0gaJpZM4MkXe5 .
This question is also discussed here #72 and there are interesting comments.
This can be closed
Hello everyone, Why we are transform the User class to UserModel, we could pass just the User instance afterall to the view. Why add this complexity ?
Thank you