Melih Aksoy
08/08/2019, 12:18 PMEric Martori
08/08/2019, 3:08 PMnetwork
may depend on domain
but no on database
Ianmedeiros
08/08/2019, 5:28 PMIanmedeiros
08/08/2019, 5:29 PMtjohnn
08/08/2019, 9:00 PMtjohnn
08/08/2019, 9:00 PMMelih Aksoy
08/09/2019, 8:53 AMdomain
should depend on network
and database
so it knows what abstractions they need, therefore network
and database
don’t depend on anything concrete from domain
.tjohnn
08/09/2019, 11:00 AMMelih Aksoy
08/09/2019, 11:36 AMdepend
doesn’t mean gradle dependency here - unlike my question, but it goes that way if I’m to separate network
from domain
.Melih Aksoy
08/09/2019, 11:41 AMdomain
depends on network
to know what abstractions it works with - not to fulfill it’s own rules. I was wondering maybe are some other practices like - just as a thought - creating a middle layer for it.tjohnn
08/09/2019, 11:50 AMports
-like layer in hexagonal architecture?Melih Aksoy
08/09/2019, 12:04 PMEric Martori
08/09/2019, 12:51 PMdomain
shouldn't depend on network
. Domain
defines interfaces
and it is the network
job to comply with said interfaces. Doesn't matter what abstractions network
uses.
For example, in domain we define an interface
interface NetworkRepositoy {
suspend fun getUser() : User //user is the domain entity, no depency with network here
}
Then in the network module this interface is implemented. This implementation may depend on external libraries like ktor or retrofit, and will probably map network models to the domain models. But there is no gradle dependency of domain
to network
, only from network
to domain
I don't know if I am missing something or don't understand the problem properlyjalexdev
08/31/2019, 1:15 AM