Recommendation: Use Package By Feature
For typical business applications, the package-by-feature style seems to be the superior of the two:
Higher Modularity
As mentioned above, only package-by-feature has packages with high cohesion, high modularity, and low coupling between packages.
Easier Code Navigation
Maintenance
programmers need to do a lot less searching for items, since all items
needed for a given task are usually in the same directory. Some tools
that encourage package-by-layer use package naming conventions to ease
the problem of tedious code navigation. However, package-by-feature transcends the need for such conventions in the first place, by greatly reducing the need to navigate between directories.
The fundamental flaw with package-by-layer style, on the other hand, is that it puts implementation details ahead of high level abstractions - which is backwards.
Separates Both Features and Layers
The package-by-feature style still honors the idea of separating layers, but that separation is implemented using separate classes. The package-by-layer style, on the other hand, implements that separation using both separate classes and separate packages, which doesn't seem necessary or desirable.
Easier Code Navigation
Maintenance
programmers need to do a lot less searching for items, since all items
needed for a given task are usually in the same directory.
No comments:
Post a Comment