The Artima Developer Community
Sponsored Link

Design Forum
Associating objects... patterns?

5 replies on 1 page. Most recent reply: Nov 5, 2003 11:51 PM by javafan13

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
krs1

Posts: 4
Nickname: krs1
Registered: Sep, 2003

Associating objects... patterns? Posted: Sep 17, 2003 5:14 PM
Reply to this message Reply
Advertisement
I'm trying to find a good, clear approach to associating objects. I have a central manager class that serves as a mapper essentially, and provides the basic CRUD functionality for each respective entity.

Certain entities can be associated with others, and I'm wondering where is the best place to perform this. For instance, assumer there is a Contact entity, and a Note entity. A note can be attached to a contact to provide a history, etc.

I'm wondering what makes more sense:

1. Provide Associate() method of some sort at the note manager level along with CRUD behaviors, taking the Note and Contact object with which to associate
2. Provide Contact properties at the Note itself, and just update the Note after its set via the manager.

The nice thing about approach one is that all management operations reside within the single interface, so its a bit more centralized. Also, if the entity could be associate with various other types (Company,Account,etc.) then its possible that with approach #2, the entity might possess properties that are empty much of the time.

Has anyone enountered any patterns dealing with this issue or just has any opinions regarding the usability of the design overall?

Thanks,

kris


Joe Parks

Posts: 107
Nickname: joeparks
Registered: Aug, 2003

Re: Associating objects... patterns? Posted: Sep 19, 2003 9:24 AM
Reply to this message Reply
I think that your two suggestions address two different questions.

1. Who's responsible for creating a Note that is associated with a Contact?

2. What are the attributes of a Note?

I think the answer to question #2 will be completely dependent on your requirements, though I suspect that the Contact would be one of the attributes--"subject," perhaps. If the subject could be more than just Contacts, then I would attempt to generalize Contact, Company, Account, etc.

Perhaps the answer to question #1 is neither the Note nor the Contact. In the real world, who creates the Note?

krs1

Posts: 4
Nickname: krs1
Registered: Sep, 2003

Re: Associating objects... patterns? Posted: Sep 19, 2003 12:36 PM
Reply to this message Reply
Hi Joe, thanks for the feedback. In response to your two questions:

1. The "user" is responsible for creating a note associate to a contact technically. They could also do this for a variety of other entities, like sale, or company perhaps.

However, the user is repsonsible for creating a ton of things... notes, companies, sales, contacts, etc. So rather than overload and create a very wide interface for "user", I had figured on moving to more finer grained specialized interfaces for individual entities (hence the note/contact manager idea.)

2. A note has basic attributes like audit information, regarding, details, etc. Its analagous to a postit note that you attach to a other entities. Since a note is associated to a contact, Contact could aslo be an attribute. However, it can be associated with many other entities, as discussed above.

I'm trying to get a feel for what makes sense the most from a design as well as usability perspective.

Thanks again!

Mike Malishko

Posts: 1
Nickname: spectr
Registered: Oct, 2003

Re: Associating objects... patterns? Posted: Oct 14, 2003 9:10 AM
Reply to this message Reply
Sorry, please, what is CRUD?

Joe Parks

Posts: 107
Nickname: joeparks
Registered: Aug, 2003

Re: Associating objects... patterns? Posted: Oct 15, 2003 8:10 PM
Reply to this message Reply
Create, Read, Update, Delete

javafan13

Posts: 4
Nickname: javafan13
Registered: Jun, 2003

Re: Associating objects... patterns? Posted: Nov 5, 2003 11:51 PM
Reply to this message Reply
I would just add the Note as an attribute of a Contract, also of an Account or anything which needs it (to which it makes sense of adding a note in the real world). Not the opposite. I guess I would also let the Contract manage the CRUD behaviour of its Note, unless your design really needs to have that much complexity that it should have note managers . But even in this case, the manager should delegate to methods of Contract dealing with its Note. As an implementation of some NoteContainer (NoteAssociate) interface.
In any case, I would NOT make the Contract associated only externally with a Note, and I would NOT make the Contract an attribute of a Note. Viceversa, it is the Contract who can HAVE a note attached to it.

Flat View: This topic has 5 replies on 1 page
Topic: little OO, XP design (lack there of) Previous Topic   Next Topic Topic: Fax server development

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use