|
About PMD
PMD is a Java Static code analysis tool written by a team of Expert Java programmers. PMD could be used to write better and optimized code by finding potential problems such as unused variables, wasteful resource creation, etc. PMD targets Java Programmers – beginners, hobbyists, Software Developers Team and we say it is for every Java programmer who wishes to employ PMD to test their code for certain rules of consistency and optimization.
It is a simple but very powerful tool with extensive support in the form of IDE Integration, Ant/Maven Tasks, etc. PMD is completely open source and the free download is available at pmd.sourceforge.net.
|
|
|
|
Purpose
The general norm with most of the popular Open Source Software is that they are extremely powerful with rich features and definitely needs a good guide to use. Usually the drawback with them is that the documentation is so dull, unlike the excitement found in the software when being used. So the need for a good book is always seen. Thanks to Tom Copeland, PMD scores in this matter. We can simply say that PMD Applied is as good as the software itself is.
Organization
Being one of the architects of PMD, Mr. Copeland has given an extensive coverage on PMD in just few hundreds of pages. Unlike other Java books, PMD Applied is not bulky but covers all the aspects of PMD that helps in using it efficiently. In this small book of 220 odd pages, one can get complete working knowledge of PMD, its internals, its best practices and customization, etc - no stone is left unturned.
There are 10 chapters in the book. The first 4 chapters help the reader to setup PMD, how to integrate PMD with popular IDE like Eclipse, JDeveloper, IntelliJ IDEA, etc and also describes usage of Ant/Maven tasks for PMD.
The fifth chapter gives elaborate information about “Copy-Paste Detector”, also known as CPD, a tool which can be well used to detect duplicate code segments and is a part of PMD. It explains why duplicate code is bad and how PMD’s CPD could be used to identify such code segments.
The sixth chapter explains the best practices one should employ while using PMD to test their project. Though there are numerous best practices that could be employed for better usage of PMD, the author concentrated only on few important ones like “Start with rules less prone to false positives”, “Start with small subset of rules”. This chapter is limited on information when compared to the other portion of the book. The author must have added more information on efficient usage of PMD, its rule-sets explaining different scenarios, the way he did successfully in other parts of the book.
The best part of the book starts here with the seventh chapter on writing rules for PMD. PMD is very extendable in the form of user defined rules, custom rule sets. Developers can write their own rules and integrate them into PMD. This chapter explains the two ways in which PMD rules can be written-using XPAth and using Java Language. It starts by explaining the management of Custom rule sets. The next portion of the chapter helps those who wish to write the PMD rules specific to their work environment. The chapter concludes with information on using Symbol table for writing PMD Rules.
The eighth chapter targets those who wish to modify PMD itself. It addresses different issues of customizing PMD like compilation of source code, adding a new report format, adding new language support for CPD. The ninth chapter is the final one on PMD and it presents PMD internals likes the complier concepts on which PMD is built, Data Flow Analysis in PMD, etc. The last chapter gives information on other tools that are similar to PMD. The information includes their activity and some of their features.
Out of the 220 pages, around 90 pages at the end have been dedicated to the PMD rules in the form of Appendix A. Though it is categorized as Appendix, it is really recommended to read at least the description of the rules. This could be very useful for every developer because they help us understand the traps and pitfalls of Java Programming. If a programmer can keep these rules in mind while programming, he shall hardly need any code verification tools in the future.
Finally
The best aspect of the book is simple and straightforward presentation. One can clearly notice the author’s best efforts in presenting PMD in a detailed manner. One can really enjoy reading the book, especially the Rules portion of the book, if they are interested in writing optimized programs. PMD and PMD Applied really help developers to write better Java code.
|
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.