This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hi, when designing app, we have horizontal layers (e.g. view, business, persistence) and vertical slices, which are more domain driven (e.g. customer, billing, common).
I can think of two ways to map this to a package structure:
(a) Taking the horizontal layer as parent, e.g.: view.customer
(b) Taking the vertical slice as parent, e.g.: customer.view
I am noticing that well structured apps often go for the (b) approach and architects and teams see their technical projects more as modules and focus on domain-thinking. In the other case I have seen that the (a) approach often leads to package decay, because people tend to only see these three layers (view, business, persistence).
Of course you can both way structure an application well (it all depends on the team quality awareness). It is just a tendency I have noticed so far.
How about you? Maybe you go a complete different approach to map your design to package structure?
Interesting question...even though the thread is a bit old.
Actually I've been doing some research into the best way to organize packages lately and have found this discussion on packaging to be extremely helpful; the other discusses packaging by feature vs layer. I think that on the surface packaging by layer (your horizontal slice above) looks more attractive...but it also takes less thought. However, packaging by feature (your vertical slice above) seems to have more expandability.
Does anyone else have anything to add to this discussion?