New Posts New Posts RSS Feed: PhoneItemViewModel
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

PhoneItemViewModel

 Post Reply Post Reply
Author
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Topic: PhoneItemViewModel
    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
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Posted: 21-Feb-2013 at 7:22am
Thanks, good points.

Greg
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down