• Post Reply Bookmark Topic Watch Topic
  • New Topic

Association Vs Dependency

 
Ajai
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


In cade's class diagram dependency is shown between Order and lineItem which would most likely be implemented as CMP-CMR relationship with Order EB having the below
public abstract Collection getLineItems()

e.g returning LineItem collection object from some method which is a dependency trait rather than an association trait(exihibited by presence of instance variable).Am I missing something?

With my understanding one example of association would be a SFSB if that is keeping some instance variables e.g userData which is used across multiple method invocations .

Can anybody validate my understanding.


Thanks.
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajai,

You said:

In cade's class diagram dependency is shown between Order and lineItem which....


Are you sure about it? I'm looking at this diagram on page #169 (not sure about the book's version) and it shows a solid line between Order and LineItem, which denotes an association. Since there are no arrows on the sides it is a bidirectional association.

-- Dan
 
Ajai
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Dan.

It should have been association.
I understand that there is ownership relationship between order and line item and thats why relationship is association but my doubt comes when we implement or code this relationship.


Thanks
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!