https://kotlinlang.org logo
Title
v

Vikas Singh

02/22/2023, 8:04 AM
Should we have a different model for presentation and domain ?
s

Sabbib Chowdhury

02/22/2023, 10:02 AM
imo it depends. is there domain logic, then yes. is domain layer more like a proxy, then no that being said, if im not wrong, according to clean architecture you should
c

curioustechizen

02/22/2023, 11:03 AM
There has been some great content in the community on this topic. For example

https://youtu.be/cfak1jDKM_4

https://blog.danlew.net/2022/08/15/domain-specific-models/ In the end I would still say it depends on your specific architecture.
In my case, in some cases my domain models are used in my presentation models (as a property or by wrapping it in some way). But it is rare for me to reuse the domain model directly for the presentation. Specifically, presentation models include things like formatting that the domain model ideally doesn't know about. On the other hand domain model often has some fields that are not relevant for the presentation model.
m

mgrazianodecastro

02/22/2023, 3:56 PM
If you plan to scale, for testing capabilities definitely
l

Landry Norris

02/27/2023, 5:39 PM
A bit late, but I’d recommend separate models for anything that models a network or DB response. A change in the DB structure should require no changes to the view layer, and vice versa. Same with network. If an API I use releases a V2 that overhauls the structure, I should only have to change the network layer to match.