The “find matching clones” looks for duplicated code.
使用“寻找匹配副本”功能,我们能够找到重复的代码。
Using a tool like CPD, however, quickly reveals duplicated code, which you can then improve.
但是,使用诸如 CPD 之类的工具,就可以迅速找出重复代码,然后对此进行改进。
Think about all of the duplicated code you'd now have spread throughout your entire class hierarchy.
想一想那些重复的代码,你需要重新设计你的整个类层次。
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.
当我隔离和移除重复代码后,数字分类器和质数检验器就变得更简单了。
Just as I did with the imperative versions, I extract the duplicated code into its own factors class, changing the name of the factors method to of for readability, as shown in Listing 8.
正如我在命令式版本中所做的一样,我将重复的代码提取到其factors类中,并且为便于阅读,将factors方法的名称改为of,如清单8所示。
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重构来降低重复度—将行为从较大方法提取到一个抽象类方法中。
At first glance, this strategy seems like a good idea — code duplication is a bad thing, so consolidating these duplicated paths should be an improvement.
乍一看,该策略似乎是一个好方法——但代码副本有错误,所以整合这些复制路径应该是一种改进。
Unit tests often need to test nuanced behavior of the code under test, leading to similar and duplicated situations.
单元测试常常需要测试有细微差异的代码行为,因此涉及到相似和重复的情况。
Most of the code is duplicated; the only unique part is the return value.
大部分代码是经过复制的;惟一不同的部分是返回的值。
Concatenation strings, usually used to reduce the code lines and duplicated expressions, can be convenient for developers, but sometimes they can require more effort in the globalization phase.
常用于减少代码行数和重复表达的串联字符串对于开发人员来说可能比较方便,但是有时候会导致全球化阶段需要付出更多的努力。
In this case, it will only indicate blocks of code that have at least 10 lines that are similar or have been duplicated.
在这样的情况下,它将只指示出那些至少有10行类似或重复的代码块。
Using enterprise beans removes the need for duplicated application code and reduces the effort spent writing database control logic.
使用企业bean除去了重复的应用程序代码需要,也减少了在编写数据库控制逻辑上所做的工作。
The common lookup code that we factored must be duplicated in every client where we want to use this pattern.
必须将这种分解后的常用查找代码复制到使用这种模式的每个客户端上。
I'm going to use reflection to create a generic sorting infrastructure that doesn't have so much duplicated, boilerplate code.
我准备使用反射(reflection)来创建一种通用的排序基础设施,其中不会涉及大量复制的样板代码。
Many similar tasks must be scripted separately because ant lacks support for loops, inheritance, and conditional processing; therefore, build code is duplicated and is sometimes redundant.
很多类似任务必须单独编写脚本,因为Ant缺乏对循环、继承和条件处理的支持;因而构建代码将出现重复,以致产生冗余代码。
USB KEY includes a password series code, which makes the USB KEY not be able to be duplicated.
USB加密狗内部包含有一个密码序列串,该密码序列串保证了USB加密狗的无可复制性。
More often than not, when designing finite state machines you will end up with code that is duplicated in every state.
通常当设计有限状态机的时候,你最后都会在所有状态中出现重复代码。
More often than not, when designing finite state machines you will end up with code that is duplicated in every state.
通常当设计有限状态机的时候,你最后都会在所有状态中出现重复代码。
应用推荐