Scott, though I didn't describe it in my example, the application does indeed have different lineTypes and we have tossed around the concept of a collectionObject. Great minds think alike ;)
-Phil
On 8/31/05, Scott Barnes <[EMAIL PROTECTED]> wrote:
As Sean mentioned today via Rays Blog, if you can get away with it, why not use QueryObjects?
Order and Line items can be be vague approach, in that what are you saving? an order or line item?
I've been finding that OO needs to be given some basic context, meaning if i were to fill out my order for say a Computer, that has various different "line items" associated to it, along with various validation complexities added.. ie If I buy X RAM its not compatible with Y mother board and what not... Then what am I dealing with directly? and how does one save that?
Thats a case for a collectionObject to be pushed into a collectionDAO as in the end, who cares how the DB stores it, its not the models concern, its the specific DAO's job to figure out where to put stuff inside the persist layer (DAO could partially load stuff inside a DB and shift other stuff over to a 3rd party technology). Its also then your "collectionObjects" job to keep the semantics of the line items in check, and can sort of act as a validation between different lineItemTypes ...gotta love OO theology...
If a Line item can exist without an Order, then you have a different set of rules and i can possibly see a candidate for a lineItemDAO unto itself, but yeah dunno how one would argue for that, furthermore if that does then crop up, nothing says you can't then ADD that to a specific need.. hell you could do a Decorator approach if you wanted to keep a run time object the ability to be used in a mutated collection format but also as an entity level.--
On 9/1/05, Patrick McElhaney <[EMAIL PROTECTED] > wrote:_Patterns of Enterprise Architecture_ by Martin Fowler describes four
ways to implement Lazy Load.
But another option may be to dig your way out of the need for Lazy Load.
If everything is modelled the most natural way, you may have a Store
with Customers with Orders with LineItems. It's easy to get to the
point where in order to load one object you have to load the whole
database (or resort to Lazy Load). My life got much easier the day I
realized I don't have to model all of those relationships.
For example, instead of getting LineItems from Order, go directly to
LineItemsDAO to get the LineItems when you need them. Order won't know
what its LineItems are, but that might work out just fine.
Often, I'll find that Order does need to know what its LineItems are,
but it doesn't need to change them. (For example, I might need to
print the order with all of its LineItems.) If that's the case, Order
might have a query of line items instead of an array of LineItem
objects.
Sometimes I find that I need to update all of my LineItems for an
order at once. I never deal with them one at a time. Naturally, I'll
put methods for manipulating line items on Order. Since I'm not
manipulating line items directly, I don't necessarily need a LineItem
object. Order could store LineItems internally as, say, a an array of
structs.
Patrick
--
Patrick McElhaney
704.560.9117
http://pmcelhaney.weblogs.us
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting ( www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
Regards,
Scott Barnes
http://www.mossyblog.com ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting ( www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
