Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

what do you think about this design?

enter image description here

In this image i have reported the dependencies between packages. I would like to reduce the coupling between them, but do you have any idea about how to do this? I think it is impossible to reduce it more than this. The Preferences package is responsible to manage program options, Persistence instead to save them in storage. Applogic and model are in domain layer.

Thanks in advance!

share|improve this question
4  
Have you heard of the Mediator pattern? Perhaps it can help you. –  faif Mar 26 '11 at 17:09
add comment

2 Answers

From my point of view, the first thing is to apply an appropriate packaging strategy. This one can help really a lot to design/organize your classes/packages and solve dependencies between them. One rule: only Top to Bottom dependencies are allowed .
Around packages, having a modular approach (even if you don't use OSGI) is the best thing you can do.

Firstly: Packaging Strategy

Secondly: Modularity

  • Fun With Modules

    [...] Tight coupling between modules is a bad idea, and the worst form of coupling is cyclic dependencies between modules. Fortunately, there are a few techniques we can use to break the cycle [...]

  • Applied Modularity: part 1, part 2, part 3, part 4

    This article explains how to "apply modularity" on a concrete and tight coupled Billing app.

share|improve this answer
3  
+1 for providing me with some reading material –  Yam Marcovic Sep 21 '11 at 9:41
    
Hey Destroyica, welcome to P.SE! Linking to articles is fine, but we usually prefer people to either copy some info from the links or elaborate in their post. That way there is info in the post even if the links go down in the future. If you could edit to add some information, that would be great. –  BlackJack Sep 21 '11 at 23:39
    
I'll do, thanks. –  Destroyica Sep 22 '11 at 7:57
add comment

This is decoupled already, what do you want more ?

In graph theory, yours nearly has the minimal number of edges (just one up the minimum actually) before you start disconnecting vertices.

The triangle App/Preferences/Persistence might look unappealing, but it is fine as long as App and Preferences deal with logically different parts of Persistence. And this has nothing to do with coupling, but with control, you don't want several parts of code doing the same task because they'll diverge in time.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.