views:

70

answers:

2

Can I make the above statement? Is it right or not? does modularity and dependencies are different thing or are inter-related? Help...

+1  A: 

They're different things, but clearly they are related. For example, if you have two (alleged;-) components A and B, but A depends on B and B depends on A, then they're not really distinct components -- they're a weird split of what clearly remains a single component. To achieve real modularity, dependencies must indeed be kept in mind -- and Dependency Inversion is one of the crucial techniques to achieve clean, correct dependencies. I'd also strongly recommend this classic book -- while most relevant if your chosen language is C++, it does contain a wealth of advice that's also applicable to many other languages.

Alex Martelli
that mean may statement "managing dependencies to achieve modularity" is not right?
komal
Managing dependencies is a necessary but not sufficient condition for modularity. If you put everything inside one big blob, there will be no interblob dependencies (since by definition that blob includes everything), but also, obviously, no modularity at all!-)
Alex Martelli
A: 

I agree with Alex - if modules are tangled, you don't really have distinct modules. And the external, inter-module dependencies are harder to control than the more visible/localized internal structure. In fact they are most often overlooked.

Also, while tangles are an objective, measurable anti-pattern, you should consider what dependency rules make sense for your specific project and processes. These are more subjective and can only be defined by you.

The key is that whatever constraints you decide on, it should be easy for the developers to know they exist and if/when they break them, and that someone senior is warned if violations make it into the integration/build.

Structure101 supports all this, and you may want to also check out Lattix, SotoArc and SonarJ. Jdepends is an open source project that detects cycles amongst other things. But start using something now - code never gets less tangled over time!

Chris Chedgey