• 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
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic