The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 Breaking the Last Dependency
Subject:  Separation of interface/impl probably preferable
Date:  2005-09-06 22:37:14
From:  timboudreau


I think the thing that you're really seeking here (or at least the compromise that retains the benefits of compile time checking while maximizing the genericness of implementation) is actually to separate this into three distinct units:
  1. The StampedeSimulator implementation
  2. The Actor API
  3. Implementations of Actor
In other words, each of the above should be separate jars, separate compilation units, etc. So, StampedeSimulator depends on Actors (presumably a jar with one class, the Actor interface), and the implementation jar depends on Actors, but the connection between the actor impl and simulators is still severed.

If you are determined to split this into only two units, then what you suggest in this article is more compelling - but that is an artifact of failing to separate interface and implementation.

One could argue that you could do away with the Actor interface entirely, but in real world programming, the number of cases where you can simply use any ad-hoc object are rare.


 Feed java.net RSS Feeds