mcd
mcd

Reputation: 1432

Presentation model in clean architecture

What should we take care while deciding presentation model for complex view.

for example in android we have one activity which contain multiple fragments which represent user basic information and qualification,awards respectively .

we have one domain model

UserProfile

should we create different presentation model for each view (UserBasicInfoModel,UserQualificationModel,UserAwardsModel)? and after user submit profile merge all presentation model and map it to domain model and gave it to interactor.

or just one UserProfileModel with some ui specific field ?

Upvotes: 0

Views: 387

Answers (1)

ingkevin
ingkevin

Reputation: 462

I would recomend to use a single ViewModel if it is indeed just one model. You have to analyze if you are not mixing things that could actually be separated.

Remember that a framework specific way of doing things (i.e. fragments) should not constrain you app's logic.

Your views may change at any time but if the model has not, why should it change?

Upvotes: 1

Related Questions