Print Page | Close Window

PhoneItemViewModel

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3994
Printed Date: 28-Apr-2024 at 7:23am


Topic: PhoneItemViewModel
Posted By: gregweb
Subject: PhoneItemViewModel
Date Posted: 20-Feb-2013 at 9:43am
In looking at the Viewmodel structure, I notice that there is a PhoneItemViewModel. So instead of binding to a collection of Entities, you can bind to a collection of PhoneItemViewModels.

It seems the properties and functions of the ItemViewModel could have been made a part of the partial entity class.

The disadvantage I see of an ItemViewModel is that you can then no longer use convention binding of Caliburn.Micro. Instead, you have to manually bind to Item.Property.

The advantage I see is that it keeps the ViewModel properties out of the Entity.

Just wondering what your take is on the matter.

Greg



Replies:
Posted By: mgood
Date Posted: 20-Feb-2013 at 1:56pm
The properties/actions/logic in the ItemViewModel have nothing to do with the entity's persistence state. They are purely for the current UI. It's a separate concern that has no business in the entity. If you later on decide to change the UI the need for the current ItemViewModel may go away or requires enhancements. Neither one should require a change to the entity. 

This is also captured by the Open Close Principle (OCP). Changing the UI should not result in a modification to the entity.

http://c2.com/cgi/wiki?OpenClosedPrinciple


Posted By: gregweb
Date Posted: 21-Feb-2013 at 7:22am
Thanks, good points.

Greg



Print Page | Close Window