https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
f

Fanilog

08/18/2020, 9:03 AM
Hello all, I’ve a question/debate around clean architecture. 👋 I’m working on a project that follows the clean architecture principles. From https://blog.cleancoder.com/=> “_Typically the data that crosses the boundaries is simple data structures. You can use basic structs or simple Data Transfer objects if you like. Or the data can simply be arguments in function calls. Or you can pack it into a hashmap, or construct it into an object. The important thing is that isolated, simple, data structures are passed across the boundaries. We don’t want to cheat and pass Entities or Database rows. We don’t want the data structures to have any kind of dependency that violates The Dependency Rule._” We can see a lot of example in the web returning
Flow<data>
from the Service layer to their Repository and Interactor. I was wondering if doing this way it’s breaking one the principles by having a strong dependency with the current implementation of the Flow (external service)?
j

John Leeroy

08/18/2020, 11:00 AM
It does break the dependency rule in the sense that we're losing flexibility by coupling each layer with the same data model. To follow clean architecture more closely, each layer would have its own data models and map to the consuming layer's data model (or you can use a hashmap).
👍 1
3 Views