Package by feature, not layer

AUTHOR: Hưng Nguyễn

The first question in building an application is “How do I divide it up into packages?”. For typical business applications, there seems to be two ways of answering this question.

Package By Feature

Package-by-feature uses packages to reflect the feature set. It tries to place all items related to a single feature (and only that feature) into a single directory/package. This results in packages with high cohesion and high modularity, and with minimal coupling between packages. Items that work closely together are placed next to each other. They aren’t spread out all over the application. It’s also interesting to note that, in some cases, deleting a feature can reduce to a single operation – deleting a directory. (Deletion operations might be thought of as a good test for maximum modularity: an item has maximum modularity only if it can be deleted in a single operation.)

Read More

Post Views: 92