title: Interface method referencing a concrete class as parameter causes coupling?
body: <p>I was thinking about programming to interfaces and not to concrete classes, but I had a doubt: should any interface method be able to hold references to concrete classes?</p>
  
  <p>Suppose the following scenarios:</p>
  
  <p>1)</p>
  
  <pre><code>public interface AbsType1 {
      public boolean method1(int a); // it's ok, only primitive types here
  }
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>public interface AbsType2 {
      public boolean method2(MyClass a); // I think I have some coupling here
  }
  </code></pre>
  
  <p>Should I choose a different design here in order to avoid the latter? e.g.</p>
  
  <pre><code>public interface MyInterface {} // yes, this is empty
  
  public classe MyClass implements MyInterface {
      // basically identical to the previous "MyClass"
  }
  
  
  public interface AbsType2 {
      public boolean method2(MyInterface a); // this is better (as long as the
                                             // interface is really stable)
  }
  </code></pre>
  
  <p>But there's still something that doesn't convince me... I feel uncomfortable with declaring an empty interface, though I saw someone else doing so.
  Maybe and Abstract Class would work better here?</p>
  
  <p>I am a little bit confused.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Ok, I'll try to be more specific by making an example. Let's say I'm desining a ShopCart and I want of course to add items to the cart:</p>
  
  <pre><code>public interface ShopCart {
      public void addArticle(Article a);
  }
  </code></pre>
  
  <p>Now, if Article were a concrete class, what if its implementation changes over time? This is why I could think of making it an Interface, but then again, it's probably not suitable at least at a semantic level because interfaces should specify behaviours and an Article has none (or almost none... I guess it's a sort of entity class).</p>
  
  <p>So, probably I'm ending up right now to the conclusion that making Article an abstract class in this case would be the best thing... what do you think about it?</p>