Carsten Ziegeler wrote:
Ralph Goers wrote:
Carsten Ziegeler wrote:
Yes, that's correct, but the api might use o.a.c.expression while the
implementation should use a different package like o.a.c.e.impl (or
something more appropriate). We should not have two modules providing
classes in the same package.
Here I don't agree. The API should only contain interfaces, abstract
classes, classes that are fairly simple (for example, if they have
nothing but getters and setters) or classes that would always be common
to any possible implementation. The impl should do all the real work.
That's my saying :) I only try to say that all impl classes should use
different package names
than the api classes.
As I pointed out though, that can create problems for the implementor.
As an example, you might have in an abstract class:
public void something(String parm1) {
something(verify(parm1), null, null);
}
public void something(String parm1, String parm2) {
something(parm1, parm2, null);
}
public void something(String parm1, String, parm2, String parm3) {
doSomething(verifyP1(parm1), verifyP2(parm2), verifyP3(parm3));
}
protected abstract void doSomething(String parm1, String parm2, String
parm3);
This construct can't be implemented if the packages aren't the same.
Carsten