https://kotlinlang.org logo
#android
Title
# android
m

Mjahangiry75

06/30/2022, 11:02 AM
Is it a bad practice to have a same model for both
retrofit
and
room?
😶 5
k

kotlinforandroid

06/30/2022, 11:38 AM
I'd say yes. It can certainly be fine if the structure maps directly to a database object. But often enough you encounter responses that contain pagination, nested JSON objects or the like that do not map directly to a database. I'd say it's better to have two models. That way you do not have to change your backend if the data representation on the network layer changes for some reason.
2