重复代码可能在代码库中悄然发生。
Duplicate code can creep into a code base unbeknownst to anyone.
即便如此还是有不少的重复代码。
But even with this, there is still a lot of code that just doesn't need to be there.
不要用重复代码的形式写注释——让每个注释都有意义。
Don't just echo the code with comments - makeevery comment count.
通用仓库模式有重复代码,所以会有什么好处?
Generic Repository Pattern have repetition of code so what will be benefit?
从低层次的重复代码中抽象出来,提高软件工程的生产效率。
Increase the productivity of software engineers by abstracting from low-level boilerplate code.
开发者必须重复代码中已有的信息,从而将配置和代码联结起来。
They have to repeat information already in the code in order to connect the configuration to the code.
在雷达的逻辑的理由类此方法的生活,并不会重复代码。
This method lives in the Radar class for logical reasons and to not duplicate the code.
清单3给出了通知订阅器的一个非常简单的实现(删除了重复代码)。
A very simple implementation of a notification subscriber (omitting repeated code) is presented in Listing 3.
清单2给出了通知使用者的一个非常简单的实现(删除了重复代码)。
A very simple implementation of notification consumer (omitting repeated code) is presented in Listing 2.
清单5给出了通知订阅器的一个非常简单的实现(删除了重复代码)。
A simple implementation of notification subscriber (omitting repeated code) is presented in Listing 5.
当我隔离和移除重复代码后,数字分类器和质数检验器就变得更简单了。
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.
该代码,希望能够自动重复代码必须提供唯一一名代表执行。
The code that wants to automatically iterate code must provide only a delegate implementation.
过滤器扩展功能将帮助提供更完整的输入评估,同时减少重复代码编写工作。
The filter extension helps provide more complete assessment of input while reducing repetitive code writing efforts.
通常,长方法和大类也暗示着存在其他代码味道,如条件复杂度和重复代码。
Often, long methods and large classes are indications of other code smells, such as conditional complexity and duplicated code.
然而,确保代码库中的重复代码不会增多这样的目标是可以实现的。
However, an appropriate goal is to ensure that duplicate code within the code base does not increase.
查找重复代码的度量方法是在代码库中的类的内部和其他类之间搜索代码重复。
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 can be quite challenging in all but the most obvious copy-and-paste violations.
但是,使用诸如 CPD 之类的工具,就可以迅速找出重复代码,然后对此进行改进。
Using a tool like CPD, however, quickly reveals duplicated code, which you can then improve.
RationalRobotvu脚本是由代表这些步骤的重复代码块组合起来的。
Rational Robot VU scripts are made up of repetitive code blocks that represent these steps.
通过去除应用中的重复代码,减少编写数据库控制逻辑的工作,这种方案降低了总的编程量。
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.
这样反反复复。通过简单的移除重复代码,我最终“偶得”一个美妙而优雅的模式。
Time and time again, I've found that by simply removing duplication I accidentally stumble onto a really nice elegant pattern.
当然你也可以不执行TDD方式,而进行重构以去除重复代码,使其更简单、灵活、更易于理解。
You can, however, refactor without performing TDD and still banish duplication while making the code simpler, easier to understand, and more flexible.
它的确通过减少重复代码和使得代码更经得起变化给我们带来了巨大的好处,最终一门完备 的语言不应该需要这样的第三方库。
While it does give us great savings by reducing repetitive code and making code more tolerable to change, ultimately a complete language should not require this of us.
它还向您提供了一个优雅的应用程序模型,利用代理模式来从您的应用程序消除大量重复代码(boilerplatecode)。
It also provides you with an elegant application model, making heavy use of the delegate pattern to eliminate much of the boilerplate code from your application.
如果您有大量的类似固有结构,那么您可以仅仅通过更新Ant文件中的一些字段来重复代码生成,从而对每个结构使用相同的选项。
If you have a large number of similar native structures, you can replicate the code generation to use the exact same options for each structure simply by updating a few fields in the Ant file.
在清单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.
求精(Refactoring):去掉在编码过程中产生的任何重复代码,你可以自信地认为这么做不会破坏任何东西,因为你还有测试作为后盾。
Refactoring: Refactor out any duplicate code generated in a coding session. You can do this with confidence that you didn’t break anything because you have the tests.
还有另一个重要的原则,在第一个案例中我们不介意有一些重复的代码,如果能够明确如何消除重复代码,我们愿意这么做,但现在还没有,我们仍然希望能找到清晰的解决方案。
Another important principle is that in the first case we don't mind having some duplicate code. If it's clear how to eliminate duplication, we do, but we are willing to wait for clarity.
每一块重复的代码都使得程序逻辑中出现错误的几率增加。
Each block of repeated code increases the chances of introducing an error into the logic.
每一块重复的代码都使得程序逻辑中出现错误的几率增加。
Each block of repeated code increases the chances of introducing an error into the logic.
应用推荐