title: How to decide whether is-a or instanceof relationship is suitable in a given situation?
body: <p>OK, this has happened to me many times now so I might as well ask the community. I often have a problem deciding whether declaring something as an instance or as an is-a inheritance (and declaring an instance of sub-class), is suitable.</p>
  
  <p>For example,</p>
  
  <pre><code>  public class BaseStation{
               public BaseStation( int x, int y ){
                      this.x = x;
                      this.y = y;
               }
  
               public void setX( int x ){ this.x = x; }
               public void setY( int y ){ this.y = y; }
  
               private int x;
               private int y;
      }
  </code></pre>
  
  <p>Now if <code>staticBaseStation</code> is-a <code>BaseStation</code> whose <code>(x,y)</code> don't change and <code>dynamicBaseStation</code> is-a <code>BaseStation</code> whose <code>(x,y)</code> do change, can't I just declare static and dynamic BaseStations as separate objects with <code>dynamicBaseStation</code> calling <code>setX</code>, <code>setY</code> everytime it's location changes? But I feel like violating OO principles by doing so.</p>
  
  <p>So basically how do I decide whether to employ inheritance when it feels just like extra-work?</p>