Dear all,

Q: Can an object (objectA) has a reference to other object (objectB)
just for the sake of representing the relationship while none of the
behaviour of objectA requires objectB?

e.g.  In a CMS system that manages many sites:  a Site has many Page.
Page has a reference to the Site to specify which site it belongs to.
However, none of the behaviour/methods of Page requires Site.

Is representing the many-to-one relationship (many Page has one Site)
a valid enough reason to have Page carry a reference to the Site
object?  Or having this reference to Site is actually unnecessary?  If
so, how else to specify that relationship?


Here's what I think... agree or disagree?

a.) Setting just the ID can represent the relationship without
reference.  But in pure OO fashion, storing siteID in Page seems
weird, afterall siteID is a PK of the Site table.

b.) If the only reason to eliminate the reference to Site is the
overhead of creating the Site object, then a SiteProxy object sounds
like a good fit.  So, just store a reference to SiteProxy in Page to
represent the relationship.


Thank you all!

Henry Ho
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to