Using a tool like CPD, however, quickly reveals duplicated code, which you can then improve.
但是,使用诸如 CPD 之类的工具,就可以迅速找出重复代码,然后对此进行改进。
The PMD plugin for Eclipse provides a feature called CPD (or Copy Paste Detector), which finds duplicated code.
Eclipse的PMD插件提供了一项叫做CPD(或复制粘贴探测器)的功能,用于寻找重复的代码。
Often, long methods and large classes are indications of other code smells, such as conditional complexity and duplicated code.
通常,长方法和大类也暗示着存在其他代码味道,如条件复杂度和重复代码。
The measure for finding duplicated code is to search for code duplication within classes and among other classes in the code base.
查找重复代码的度量方法是在代码库中的类的内部和其他类之间搜索代码重复。
Finding duplicate code manually is challenging, but using a plugin like CPD, however, quickly reveals duplicated code while you are coding.
靠人工来寻找重复的代码是一项挑战,但使用像CPD这样的插件却能在编码时轻松地发现重复的代码。
This reduces the total programming effort by removing duplicated code in the application and by reducing the amount of effort spent in writing database control logic.
通过去除应用中的重复代码,减少编写数据库控制逻辑的工作,这种方案降低了总的编程量。
Once I've isolated and removed the duplicated code, both the number classifier and the prime-number tester are much simpler. Listing 4 shows the refactored number classifier.
当我隔离和移除重复代码后,数字分类器和质数检验器就变得更简单了。
In Listing 6, I take the duplicated code in Listing 4 and reduce the duplication by using the Pull up method refactoring - extracting behavior from a larger method into an abstract class method.
在清单6中,我用了清单4中的重复代码,使用了PullUpMethod重构来降低重复度—将行为从较大方法提取到一个抽象类方法中。
In Listing 6, I take the duplicated code in Listing 4 and reduce the duplication by using the Pull up method refactoring - extracting behavior from a larger method into an abstract class method.
在清单6中,我用了清单4中的重复代码,使用了PullUpMethod重构来降低重复度—将行为从较大方法提取到一个抽象类方法中。
应用推荐