It seems to me like this is diluting the cohesion of the ArticleBO. Should it really also be dealing with comments? I’m thinking probably not. Is there a way you can handle this relationship in a higher level class, like in a BlogContentManager? I think it would mean having having an ArticleDAO and a CommentDAO though, and an ArticleGateway and CommentGateway, so it would mean more classes for the BlogContentManager to deal with.

 

I’d be interested to hear what everyone else thinks as well.

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, January 11, 2005 2:31 AM
To: [email protected]
Subject: [CFCDev] Newbie approach to Composite Entity pattern.

 

Hi,

 

I've got a concept i need to bounce off others, its similiar in its approach to say "Articles" has many "Comments"  (ie Article has-a comment(s)).

 

In my Approach (using the above basic example) i would create:

 

ArticleBO (Composite Entity)

    - commentBO (Dependent Object1)

    - commentBO (Dependent Object2)

etc..

 

 

Is it save to say that the ArticleBO has methods like:

 

- setTitle(string)

- setBody(string)

- setPubDate(date)

- addComment(commentBO)

- removeComment(commentBO)

- findCommentByID(string)

 

I guess what i'm trying to do is combine the efforts of a "Bean" and "Facade" into one object that my controller/container accesses. So in the event i add a comment to my article, i invoke addComment(), pass in a collection of arguments (or object) and it stores that information within itself.

 

I then pass that ArticleBO to my DAO, which stores all the Article "information" into say "Articles Table" and comments into "Comments" table or however i wish to implement storage (ie could serialize the entire bean to a wddx packet or something)

 

Is this a typical approach to objects that have many dependent objects. I read that "Composite Entity Bean" works like this (Or I may loose this in translation - probably the case).

 

 

Regards,

--------------------------------------------------

Scott Barnes

System Development Engineer

 

Goro Nickel Project
Level 8, 201 Charlotte Street
Brisbane QLD 4000
Email:
[EMAIL PROTECTED]

 

Reply via email to