Which style to you prefer when you use Interfaces and Implementations?
A) Separate them.
projectName/dao/
Blah.java
projectName/dao/impl/
BlahThis.java
BlahThat.java
B) Keep them together, and identify:
projectName/dao/
IBlah.java
BlahThisJdbc.java
BlahThatJdbc.java
I like B, just because the interfaces are right next to the implementations.
It’s probably a bad idea to separate them simply because they are implementations and interfaces.
Hell, I don’t even like to make the naming of them reflect the fact that they are interfaces. I like to just think of them as weak(er) abstract classes.
I think you should just think about whether or not the implementations belong together. If all your implementations belong together in the same package then they probably should be with the interface. It makes sense in the “weaker abstract class” way of looking at interfaces.
However if your interface is a project wide thing, then your implementations are spread across hell’s half acre, so you need to move it up in the package tree until it’s a Least Common Ancestor of all the classes that implement it. Or just stick your interfaces somewhere. It doesn’t make a huge difference.
It’s a bikeshed painting situation.
http://www.bikeshed.com/
B.
cause thats how we do.