In theory it sounds good but with CF's penalty of object creation it is probably overkill in this case.
Look at the Iterator / IBO pattern for CF as it allows you to achieve a design like this without the performance hit of creating arrays of Employee objects and composing them into your Company object. Have your Company object have an association with an Employee Iterator / IBO and you can get the benefits without the performance hit. There's an inheritance-based IBO or a 'composition' based Iterator. Both work well so just pick one you like best. http://ibo.riaforge.org/ http://iterator.riaforge.org/ Other links http://www.fancybread.com/blog/index.cfm/2007/5/10/Create-Iterating-Domain-Objects-Using-Composition http://www.pbell.com/index.cfm/IBO http://www.alagad.com/go/blog-entry/ibo-a-coldfusion-design-pattern http://www.bennadel.com/blog/412-ColdFusion-Iterating-Business-Objects-IBOs-From-The-Ground-Up.htm ----- Original Message ---- From: John Whish <[EMAIL PROTECTED]> To: [email protected] Sent: Monday, September 29, 2008 11:51:05 AM Subject: [CFCDEV] one-to-many relationships Coming from a database orientated background I've always thought of relationships between two objects in the same way. If I have a company object and an employee object then the employee object would hold a reference to the company object. Recently I wanted to get a list of employees for the company and it got me thinking that instead of looking up to the database, maybe I should be holding an array of employees in the company object. This has some advantages, but seems like a bad idea. Has anyone actually done it like this? Thanks in advance :-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CFCDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfcdev?hl=en -~----------~----~----~----~------~----~------~--~---
