• 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

Has-A relationship

 
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can we say that has a relationship supports high cohesion as it allows a class to be more specialized.....and what about coupling? coupling means how much a class knows about the other or the Api stuff....having a has a relation doesnt mean that the class knows only about the api stuff....so i dont think we can say anything about that....but in good OO we will have loose coupling

and what about encapsulation? in good oo design again good encapsulation but about non oo design???



 
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How does has-a makes a class more specialised?

coupling means how much a class knows about the other or the Api stuff....having a has a relation doesnt mean that the class knows only about the api stuff....so i dont think we can say anything about that....but in good OO we will have loose coupling



thats correct.
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey neha....specialized is related to cohesion and not coupling.....you posted a coupling answer to cohesion
 
Neha Daga
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, first one is my question and second one is answer to your question.
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well since a class is using another class means that it is using the services of another class instead of implementing those servies itself....which means it only does specialized work whereas uses the work of anther class to do work which it cant do........i guess this what specializing means....

a manager uses two different people..one to look after the accounts and one to lok after the sales....with himself looking after the hrd department.......this is has a relationship with specializing
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
does making the methods private lead to loose coupling? the 2 minute drill of k&b says that loose coupling is the desirable state of having classes that are well encapsulated......how best is this true?

or coupling is only related to the amount api stuff one class knows about the other.....but others are trivial to this one?

 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Raju Champaklal wrote:does making the methods private lead to loose coupling? the 2 minute drill of k&b says that loose coupling is the desirable state of having classes that are well encapsulated......how best is this true?





i can say above example is Loose Coupling

Raju Champaklal wrote:
can we say that has a relationship supports high cohesion as it allows a class to be more specialized.....and what about coupling?



Obviously, tight coupling
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic