Hi John,
Thank you for your answer.
Oh man, I am typing this the second time because I hit the back
button.
The more I think about it, the more I get accustomed to packaging by
feature. Regarding the test classes, I fell back into good old package
by layer. But I quite like the idea that tests go into the same
package as the classes they are testing; they are definetely coupled.
Filtering the test classes using Ant is no problem, you are right.
Concerning interfaces, I meant the ones under my control. We usually
use Spring for dependency injection. So the fields of a class have an
interface type, and concrete implementations are injected. This also
allows to create mocks more easily.
I think I go along with you: in this case interfaces and
implementation classes should go into the same package.
If I wrote an API to a library or framework, it would probably make
sense to put some interfaces into a separate location.
Sometimes it is not that easy to find the actual features. Not every
domain class makes up a single feature. I think package by feature is
also found (at a higher level?) in the modularization that plugin
system like the ones from Eclipse or NetBeans do. They also divide the
application in different feature sets, although not at the package
level.
Since my questions are answered so far and I like the concept quite
much, I will go ahead and give it a try. Thanks for the inspiration.
Do you listen to the JavaPosse podcast? I know that you have your own
survey on
javapractices.com, but what do you think of posting a
question to the JavaPosse moderator group. I would like to hear some
more opinions on package by feature.
Regards,
Christian Beil