It this point I think it is a good idea to clarify the responsibilities of each component:
Form (View):
- Manage all the controls on the form
- Present the data on the entity object
- Update the entity object with users edits
Entity (Model):
- Hold the data
- Manage default states (blank, keep data etc)
- Domain logic relating to this entity
- Persist data on entity object
- Populate entity object to contain data for currently selected record.
I'm keen to move as much domain level logic out of the form, into the entity class as possible. This is for two reasons: the forms should be for presentation of the data only and the entity objcet should be more than just a data-holder. I'm going to focus more on this second reason.
Classes that do not have any methods, just data-properties, are child-like classes... they haven't grown-up yet. They are a good starting point, but if they stay as data-holders, there is something wrong with the overall design. Something is doing the work that this class should be doing.

No comments:
Post a Comment