• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Association Classes in class diagram

 
Parag Doshi
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wanted to know whether association classes are considered "bad" in a class design due to its implications on implementation (managin maps in either side of the relationship etc) or are they alrite to design?
In continuation to this question, I also wanted to know whether we need to show relationship of this association class with other classes (SearchService etc) or only with the 2 classes which it is associated with?

Any help would be appreciated.

Thanks,
Parag
 
Tomi Tuomainen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parag,

Generally I think association classes should be modeled by (database) designers and architects shouldn't stress about them. On the other hand we should extend BDM and model concepts more precisely. I decided to add such classes, because I think the class diagram is quite unclear otherwise. (for example, which class holds reserved seats?)

When modeling association classes only the association with the two classes should be shown (my opinion).

Tomi
 
Darryl A. J. Staflund
Ranch Hand
Posts: 314
2
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

If you are going to use association classes together with CMP / CMR, remember to keep in mind that CMP / CMR relationships can only be defined between EJBs within a given EAR file. Any association classes established between classes that will ultimately be deployed in different EAR files (as well as the association class itself) will have to use BMP / BMR.

There are definitely some good association class candidates in the application -- depending on what you identify as being your base classes. Some examples:

* 'Seat Reservation' reserves a 'Seat' on a 'Plane' for a given 'Itinerary'.
* 'Ticket' records the 'Payment' of an 'Itinerary' for a given 'Profile'.

etc.

Darryl
 
Parag Doshi
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys..
I also agree that there are quite a few places where the association classes can be used. I was just a bit uneasy about using them, but reading the answers now, I think I am on the right track.
Yes Tomi, I also was of the opinion that the association should be only btw the 2 classes which are associated with it.
My confusion came with the fact that I have an associated class which would help the search flight module and hence was wondering whether I need to show any relationship (uses, depends etc) with the search service. Any thoughts?

Darryl, I agree that I have to be careful what kind of persistence mechanism I use as the associated class is tightly coupled with the association. Thanks for your tips, I shall keep that in mind while modelling the implementation.

Guys, is it considered "normal" to have more 1 associated class relationship? For example, in the answers I already see one definite candidate and I also have come up with another set of associated classes. Will the SUN guy think I am over-engineering the solution?

Any feedback would be appreciated.

Thanks,
Parag
 
Tomi Tuomainen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Parag Doshi:

My confusion came with the fact that I have an associated class which would help the search flight module and hence was wondering whether I need to show any relationship (uses, depends etc) with the search service. Any thoughts?

Sounds like you might want to show this kind of relationship. On the other hand I think Cade is not showing all the relationships between a controller bean and classes: there will probably be more references in the design phase.


Guys, is it considered "normal" to have more 1 associated class relationship? For example, in the answers I already see one definite candidate and I also have come up with another set of associated classes. Will the SUN guy think I am over-engineering the solution?

I'm not quite following here (could you give a more precise example?) but I think the only way to over-engineer is to put there too much implementation stuff. Separating concepts in smaller (natural) classes is what we are supposed to do.

Tomi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic