Install Eclipse plug-in
Installing the Eclipse plug-in is no longer easy, but only a few steps are required. Before getting started, you 'd better prepare the URL of the plug-in download site. Table 1 lists the plug-ins used in this article:
Table 1. Code improvement plug-ins and corresponding download site URLs
Tools |
Purpose |
Eclipse plug-in URL |
Checkstyle |
Encoding standard analysis |
Http://eclipse-cs.sourceforge.net/update/ |
Coverlipse |
Test code coverage |
Http://coverlipse.sf.net/update |
CPD |
Copy/paste Test |
Http://pmd.sourceforge.net/eclipse/ |
Jdepend |
Package dependency analysis |
Http://andrei.gmxhome.de/eclipse/ |
Metrics |
Complexity monitoring |
Http://metrics.sourceforge.net/update |
Use jdepend for dependency check
Jdepend is an open-source tool that can be obtained free of charge. It provides object-oriented measurements for the package dependency to indicate the elasticity of the code library. In other words, jdepend can effectively measure the robustness (vice versa) of an architecture ).
In addition to the Eclipse plug-in, jdepend also provides an ant task, Maven plug-in, and a Java application to obtain these metric values. They have different transfer mechanisms for the same information, but the special and advantages of the Eclipse plug-in are that it can be closer to the source code (that is, during encoding).
Figure 10 shows how to use the eclipse jdepend plug-in: Right-click the source folder and choose run jdepend analysis. Be sure to select a source folder with source code; otherwise, you will not be able to see this menu item.
Figure 10. Analyze code using jdepend Analysis
Figure 11 shows the report generated when jdepend analysis is run. The package is displayed on the left and the dependency metric value for each package is displayed on the right.
Figure 11. Package dependencies in the Eclipse project
As you can see, the jdepend plug-in provides a large amount of information that helps you continuously observe changes in architecture maintainability-the biggest benefit of this is that you can see the data during coding.