i dont know which (if any) make more sense for your problem.

scenario 1:

you could deal with them as completely separate objects with the heavyweight 
ones interface extending that of the more lightweight one.

scenario 2:

does it make sense to construct a builder and pass that into the object 
(dependancy injection reasons)  ... this gives you two options.

scenario 2.1:
depending on the context you can pass in a heavyweight or lightweight builder 
and throw an error if heavyweight attribute is accessed in a lightweight 
context.

scenario 2.2:

you can have the object lazily construct itself using the builder passed in. 
the builder will allow you to cleanly define population of data that happens in 
two or more steps (lightweight and then on to heavyweight if any of those 
attributes is required).

good luck,

-saad

Bill Bassler <[EMAIL PROTECTED]> wrote: I'm looking for the best way to handle 
the situation where a particular
object represents a business entity is used for multiple purposes.

For example: A Person object.
In some cases I need a object that contains a great amount of detail about
a Person; say, name info, address, education background and detailed
buisness-centric information. This object is typically used for detailed
buisness logic processing. I also have a need for the the same entity just
serve the purpose of filling a drop down list with a list of First Name,
Last name for a UI selection.

In the first purpose I need a "full featured" object. In the second purpose
I do not. Also, performance is likely an issue here, as usual.

Question: Is there an OO pattern or concept that addresses these types of
requirements for design? I see the following patterns as possiblities.
Opinions please.

Builder pattern
Decorator pattern

===================================
This list is hosted by DevelopMentor�  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com




---------------------------------
Yahoo! Photos
 Ring in the New Year with Photo Calendars. Add photos, events, holidays, 
whatever.

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to