• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to decide whether use IS A or HAS A Relation

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Assume that i have a above class , by which parameters should we decide what to use ?? Whether is a or Has a Relation ??

HAS - A

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on what you are modelling. Most of the time, if you're thinking about a concrete problem domain, it will be clear to you whether there is an "is a" or a "has a" relation between the things that you are modelling.

For example, suppose that you want to model a car. Clearly, a car has an engine, wheels, etc. And a car is a transportation device, etc.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic