Read-Only Properties in Editable BO -- Best Practices Question

Read-Only Properties in Editable BO -- Best Practices Question

Old forum URL: forums.lhotka.net/forums/t/1771.aspx


rob123 posted on Wednesday, November 15, 2006

I have a several editable business objects where it would be useful to display read-only properties.  For the most part, the read-only properties will reflect default values that can be overriden by editable properties.  I want to display all of these properties on the same FormView control.

Here is a simple example with four objects.

JobDefinition, JobParameterDefaults, JobInstance, JobParameterOverride

I would like to store read-only default information (a subset of the properties in the JobParameterDefaults object) on the editable JobParameterOverride object.  I understand that I could create separate BOs, but this seems unnecessary since the "default" properties are tightly coupled with the "override" properties.

My question is simply one of best practices.  Should I try to logically group the read-only object objects together?  I want it to be clear to other developers what properties require UI interaction.  I've considered using naming conventions, child objects (this option make data binding awkward), or doing nothing at all.

Any thoughts?

Rob

david.wendelken replied on Wednesday, November 15, 2006

I'm guessing that JobParameterOverride contains the actual parameters for the job, and JobParameterDefaults contains the default parameters for the job.

If so, I have a question. 

Is the number of parameters for the job fixed and just the parameter values can be overridden, or can parameters be added/deleted to the job?

If the former, why not make the default values a read-only property of JobParameterOverride?

If the latter, nevermind...

rob123 replied on Thursday, November 16, 2006

The number of parameters is fixed.  My question is really about standards and best practices.  I want to establish a standard that allows other developers to quickly understand that some of the properties in my editable object are read-only and do not require full data binding (i.e. Updates and Inserts).  For example, if I used naming convention read-only properties in editable objects would be named InfoDefaultValue, InfoDefaultType, etc...

Perhaps I'm over-thinking this, but it bugs me to create objects where it may be unclear as to what properties require user input.

 

mr_lasseter replied on Thursday, November 16, 2006

I think you are over engineering a little, intellisense should take care of this.  I don't think there is any standard naming convention for ReadOnly properties, take a look at the .Net framework itself.  If there were what would you do when one of your read only properties changes to an editable property? Would you have 2 properties displaying the same information? 

 

 

rob123 replied on Friday, November 17, 2006

I think you're right -- I'm over-engineering this.  :)

Copyright (c) Marimer LLC