File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes OO, Patterns, UML and Refactoring and the fly likes best way to map a design to a package structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "best way to map a design to a package structure" Watch "best way to map a design to a package structure" New topic

best way to map a design to a package structure

manuel aldana
Ranch Hand

Joined: Dec 29, 2005
Posts: 308
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.:

(b) Taking the vertical slice as parent, e.g.:

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?

Thanks for your thoughts!

aldana software engineering blog & .more
bryan nelson
Ranch Hand

Joined: Jun 16, 2003
Posts: 95
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?

"...and the Truth will set you free."
Victor Ramen
Ranch Hand

Joined: Jul 14, 2008
Posts: 56
I have seen approach (b) for complex real life applications and approach (a) for simpler tutorial kind of applications.
I agree. Here's the link:
subject: best way to map a design to a package structure
It's not a secret anymore!