开发者

Need a Java Package Dependancy Analysis Tools

Is there anyway to run a package dependency analysis using jDepend, ant contrib's verifydesign task, or any other similar tool, which uses blacklists instead of whitelists?

That is to say, I want to be far less strict (at least initially). Instead of specifying package A must only depen开发者_运维技巧d on B, C and K; package B must only depend on Q, W and R; etc. for every package in the system, I'd like to begin by saying: package A absolutely can't have any contact with W and Y, and anything else it does is alright by me. I could then gradually add in the full list of expected dependencies (A depends on only B, C, K) for each package over time, as things are refactored.

So does a tool exist to do this?


You can do this with Structure101 Architecture Diagrams since the diagrams can contain a subset of your codebase. In your example, you could create 3 cells in the diagram for A, W and Y, placing W and Y above A in the diagram (dependencies can only flow downwards, or at least an upward dependency is considered a "violation" of the diagram). Placing W and Y side-by-side above A says that there should be no dependencies between W and Y. If you don't want to restrict dependencies between W and Y (yet), you can merge them into a single cell and inter-dependencies will not be checked. The rules are automatically checked and you can generate warnings and/or errors (break the build if you want). And you can gradually add to the diagram as your refactoring effort progresses...


I can do one better: you can express such things in AspectJ AOP so that it can be enforced at runtime. "AspectJ In Action" shows you how.


verifydesign can be less strict in that you can define a "wad" so to speak and make it more and more strict. A link to an article that has a piece on legacy systems(which are typically violating tons of the intended design).

http://www.devx.com/opensource/Article/33729/0/page/4

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜