Open narendrakothamire opened 7 years ago
@narendrakothamire Data layer resides one level above than Domain (that is core layer in clean architecture) so it's ok to use models and other classes from lower layer in above layer/s. Clean approach only says that you can't do reverse, for example : you can't use Data entities in Domain layer because it ruins boundaries.
@MikeHerasimov You can't use Data entities in Domain layer because it ruins boundaries. Domain layer has used data entities as well. Presentation can have domain layer things and Domain can have data layer things but not reverse -As per my knlwg
@narendrakothamire "Domain layer has used data entities as well." I'm not sure about this (first of all because @ihorvitruk uses mappers), can you provide some links?
Domain can't have data layer things because Data layer is above Domain. In clean architecture we have Domain <- Data <- Presentation (pointers show dependency)
As I said earlier Domain layer is our core layer.
@narendrakothamire as far as I see you thought that Domain is our middle layer, it can be confusing at first because this layer has data from Data layer, but not directly.
In clean it is done by repository pattern.
I don't know where you started you Clean Architecture learning, you may want to take a look at some articles and repos in section 6 (I'm just too lazy to copy all of them) https://blog.aritraroy.in/what-my-2-years-of-android-development-have-taught-me-the-hard-way-52b495ba5c51#.w3idnlv2m
I knw clean architecture very well U look this link from where this lib code has been taken https://github.com/android10/Android-CleanArchitecture
I alredy saw this repo and all articles related to it. you know clean architecture very well but claim that "Domain can have data layer things" I've tried to help but I guess that you just trolling me
@MikeHerasimov is right on this. Data layer is an implementation layer (of the repository interfaces in the Domain layer). This is the same pattern followed in the https://github.com/android10/Android-CleanArchitecture link provided by @narendrakothamire.
I have seen that you have used Domain layer components in Data layer as per clean architecture Data layer component should not be used in Data layer component