Pair Programming with PMD

The Cost of Pair Programming

As you guys have known, Pair programming is one of most important best practice of Extreme Programming and other agile software approaches.  It can reduce bug rate significantly, it also has positive impact on improvement of programming skill, but the cost of pair programming is, boss have to hire more programmers to work together. Due to the finance concern, very few boss and orgnization adopt pair programming as their best practice.

In fact, an variant of pair programming can be used in very LOW cost. Programmers can "pair programming" with code checking tools, instead of human being programmer. In other words, we can programming with "robot" programmer.

What's PMD

PMD is a powerful static code checker for Java language, I don't want give a long definition here, because Wiki has gave a clear one.

PMD is a static ruleset based Java source code analyzer that identifies potential problems like:

  • Possible bugs - Empty try/catch/finally/switch blocks.
  • Dead code - Unused local variables, parameters and private methods.
  • Empty if/while statements.
  • Overcomplicated expressions - Unnecessary if statements, for loops that could be while loops.
  • Suboptimal code - Wasteful String/StringBuffer usage.
  • Classes with high Cyclomatic Complexity measurements.
  • Duplicate code - Copied/pasted code can mean copied/pasted bugs, and decreases maintainability.


As mentioned in last sector, PMD is a static code checker can detect potential program in java source code. There are lots of similar tools in open source community, but PMD has its own competitive advantage.

  • Easy to Get
  • Easy to Use
  • Powerful
  • Customizable
  • Document and support

findbugs ( is an alternative powerful static check tools, if you don't like PMD.

How to use PMD

PMD has provide plug-in for eclipse. It help you to detect and fix potential issues in workspace with GUI support.

This page give a brief but clear instruction on installing of eclipse plugins.

Once you complete the installation, you can check your code with context menu of PMD plugin.

1. Switch to PMD perspective

2. Select a java file you want to check

2. Right click mouse, select PMD->Check code with PMD.

PMD list violations in both outline window and Text editing box if it found some violations in your source code. Violations be assigned different level, some of them are critical while others are not. Usually we should focus on at least critical issues.


PMD can support us to find potential problems, bad practices and methods that has too much complexity. Programming skill of programmer also can be improved with PMD because programmers can know what bad practice is. In general, PMD can help software team to reduce defect rate and improve productivity.






<p> <b><span style="font-size:14px;"></span><span style="font-size:14px;background-color:#FFE500;">【Java面试宝典】</span></b><br /> <span style="font-size:14px;">1、68讲视频课,500道大厂Java常见面试题+100个Java面试技巧与答题公式+10万字核心知识解析+授课老师1对1面试指导+无限次回放</span><br /> <span style="font-size:14px;">2、这门课程基于胡书敏老师8年Java面试经验,调研近百家互联网公司及面试官的问题打造而成,从筛选简历和面试官角度,给出能帮助候选人能面试成功的面试技巧。</span><br /> <span style="font-size:14px;">3、通过学习这门课程,你能系统掌握Java核心、数据库、Java框架、分布式组件、Java简历准备、面试实战技巧等面试必考知识点。</span><br /> <span style="font-size:14px;">4、知识点+项目经验案例,每一个都能做为面试的作品展现。</span><br /> <span style="font-size:14px;">5、本课程已经在线下的培训课程中经过实际检验,老师每次培训结束后,都能帮助同学们运用面试技巧,成功找到更好的工作。</span><br /> <br /> <span style="font-size:14px;background-color:#FFE500;"><b>【超人气讲师】</b></span><br /> <span style="font-size:14px;">胡书敏 | 10年大厂工作经验,8年Java面试官经验,5年线下Java职业培训经验,5年架构师经验</span><br /> <br /> <span style="font-size:14px;background-color:#FFE500;"><b>【报名须知】</b></span><br /> <span style="font-size:14px;">上课模式是什么?</span><br /> <span style="font-size:14px;">课程采取录播模式,课程永久有效,可无限次观看</span><br /> <span style="font-size:14px;">课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化</span><br /> <br /> <br /> <span style="font-size:14px;background-color:#FFE500;"><strong>如何开始学习?</strong></span><br /> <span style="font-size:14px;">PC端:报名成功后可以直接进入课程学习</span><br /> <span style="font-size:14px;">移动端:<span style="font-family:Helvetica;font-size:14px;background-color:#FFFFFF;">CSDN 学院APP(注意不是CSDN APP哦)</span></span> </p>
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页