• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Association Vs Dependency

 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Happily living in the valley of the dried frogs with a few tiny ads.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic