Hi Aaron, We have an application architecture that consists of a couple layers of of controllers and entities: a service layer to govern communication with backend services and a business layer on top of that to govern objects representing business concepts/rules. The presentation layer consists mainly of ungoverned CFM templates at this time, although a formal PL controller and entities are in the works.
Each BL object is in charge of keeping track of its relationships with the other BL objects. This amounts to a set of one-dimensional arrays of "id lists" that are cached into the object only when necessary. Each list has a load method that handles the request to the service layer for the data and the caching, a get method that returns the id list, and a boolean method that takes a specific id number and answers back true or false based on the presence of a matching value in the list. Names are fairly explicit -- for example, a customer-product relationship array would be aCustomerProductRelationshipIDList, and the methods would be loadCustomerProductRelationshipIDList(), getCustomerProductRelationshipIDList(), and isCustomerRelatedToProduct(product_id). The boolean method leverages a binary search algorithm in order to keep looping to a minimum, since these questions are asked a lot. This methodology works great, especially because the BL controller can pull these id lists to assemble arrays of related objects or data structures based on the requests coming into the business layer. This has proven to be extremely helpful when bringing data together that is managed across disparate services on the backend. If you have more questions, let me know, Matt Matthew Drayer Development Manager HCPro, Inc. Marblehead MA [EMAIL PROTECTED] -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Roberson Sent: Wednesday, December 20, 2006 5:47 PM To: [email protected] Subject: [CFCDEV] Help with Object Relationships I am converting my spaghetti code application into OOP and have separated everything out to beans, gateways, DAOs and services. I am running into a wall trying to figure out how to establish relationships between objects. For example, I have the following tables in my database that have one-to-many and many-to-many relationships: PRODUCTS (table) prodid (pk) title description price ARTICLES (table) articleid (pk) authorid (fk) title content PROD_ART (linking table) prodid (fk) articleid (fk) AUTHORS (table) authorid (pk) firstname lastname bio How would I define these relationships? Each author has several articles, each article is related to many products and each product is related to many articles. I have installed and created a blog using Model-Glue Unity to see how Reactor defines these relationships but I cannot translate that over to my application. Do I create these relationships in the service layer, gateway, bean, etc? Thanks for your help, Aaron Roberson You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[email protected] You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
