Is it a bad practice to have a same model for both...
# android
m
Is it a bad practice to have a same model for both
retrofit
and
room?
😶 5
k
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