• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Association vs Dependency

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Reading from different posts from this site what I understood
that association is more stronger than dependency.

ClassA has association with ClassB -- if ClassB is instantiated by ClassA.
ClassA has dependency with ClassB -- if ClassB is passed as parameter in
a method or returned as parameter from a method call.


Now consider a case:

Client is using three classes atabase, Model, Element.

Client instantiates Database object, using the Database object gets
reference of Model object and after that calls method on Model object
to get Element. On the Element object client further calls method to
get the element inside the Element object.

In this case, I think relationship should be:
Client ---->(Association)-->Database
Client ---->(Dependency)--->Model
Client---->(Dependency)--->Element


But, I am reading a book, in this book all relationships has been shown
as association from the client.
Client ---->(Association)-->Database
Client ---->(Association)--->Model
Client---->(Association)--->Element


I would appreciate for any input.

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
Martin Fowler says in UML Distilled:

Many UML relationships imply a dependency. The navigable association from Order to Customer in Figure 3.1 means that Order is dependent on Customer. A subclass is dependant on its superclass but not vice versa.



Regards,
Dan
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic