不要用重复代码的形式写注释——让每个注释都有意义。
Don't just echo the code with comments - makeevery comment count.
从低层次的重复代码中抽象出来,提高软件工程的生产效率。
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.
清单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 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.
查找重复代码的度量方法是在代码库中的类的内部和其他类之间搜索代码重复。
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.
当然你也可以不执行TDD方式,而进行重构以去除重复代码,使其更简单、灵活、更易于理解。
You can, however, refactor without performing TDD and still banish duplication while making the code simpler, easier to understand, and more flexible.
它还向您提供了一个优雅的应用程序模型,利用代理模式来从您的应用程序消除大量重复代码(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.
Eclipse的PMD插件提供了一项叫做CPD(或复制粘贴探测器)的功能,用于寻找重复的代码。
The PMD plugin for Eclipse provides a feature called CPD (or Copy Paste Detector), which finds duplicated code.
像Rails那样使用这种方法,您可以两全其美:具有较少重复的简洁代码而不会失去灵活性。
Using this approach, as Rails does, you get the best of both worlds: concise code with less repetition without sacrificing flexibility.
工厂需要大量冗长重复的代码。
每一块重复的代码都使得程序逻辑中出现错误的几率增加。
Each block of repeated code increases the chances of introducing an error into the logic.
对于所有重复的代码,一定会出现不一致性,因此将很难进行维护。
With all that repeated code, you're bound to have inconsistencies, and it will be hard to maintain.
有时候,使用这种语句比嵌套的for循环或if语句更好,可以减少重复的代码而且结构更清楚。
Using such a statement can sometimes be a better route than nested for loops or if statements to cut down on repetitive code or just for better structure.
添加ViewComponentParam属性,它可以告知MonoRail把参数作为属性绑定到你的视图组件上——减少了重复的代码规则。
Added ViewComponentParam attribute which tells MonoRail to bind the arguments as properties on your view component - reducing repetitive code rules.
最糟糕的是,您要对所编写的每一个POJO重复这样的代码序列。
What's worse is knowing you'll have to repeat this exact sequence of code in every POJO you write.
可以通过调用这个标记在多个位置使用自定义标记,无需在不同的地方重复编写相同的代码。
You can use a custom tag on multiple places simply by invoking the tag, and remove the repetition of writing the same piece of code in different places.
许多代码是重复的(例如,有许多对列表的append方法的调用),这为错误创造了空间。
A lot of code is repeated (for instance, the many calls to the list append method), which creates room for error.
比方说在某些时候,您发现自己在很多不同的方法中都重复编写了相同的几行代码。
Sometimes, for example, you find yourself repeating several lines of code in several different methods.
应用推荐