减少数据访问层中的代码重复。
PMD的CPD:帮助发现代码重复
用CPD捕捉代码重复。
CPD报告代码重复。
这使得我可以避免代码重复,从而比使用过程语言更为优雅。
This enabled me to avoid code duplication more elegantly than I could have with a procedural language.
查找重复代码的度量方法是在代码库中的类的内部和其他类之间搜索代码重复。
The measure for finding duplicated code is to search for code duplication within classes and among other classes in the code base.
泛型dao模式(也称为类型安全的DAO)对于减少数据访问层中的代码重复非常重要。
The generic DAO pattern (also called Typesafe DAO) is critical to reducing code duplication in the data access tier.
这条规则,以及做好一件事情的规则,都是一个根本原理的必然结果:无论何时都要尽可能避免代码重复。
This rule, and the rule to do one thing, are both corollaries of an underlying principle: avoid duplication of code whenever possible.
会话bean中的这个逻辑将强制客户机一直做正确的事情,确保应用程序中的一致性并防止客户端的代码重复。
This logic in the session bean will force the clients to always do the right thing, ensuring consistency in the application and preventing code duplication at the client side.
提取通用行为并把它们包含在泛型DAO 中,让类的所有用户通过泛型 DAO访问这些功能,这样就可以减少代码重复。
You can reduce code duplication by abstracting the common behavior and including it in the generic DAO, where all users of the class will have access to the functionality.
本文的代码示例(在下载中可以获得完整的代码包)演示如何使用这些接口帮助执行审计和减少数据访问对象(DAO)中的代码重复。
This article's code examples (see Download to obtain the full package) show how to use these interfaces to facilitate auditing and reduce code duplication in data access objects (DAOs).
原始强迫症(Primitive Obsession,缺少正确层次的抽象)会导致大多数问题,包括代码重复和条件复杂度。
My take was that its Primitive Obsession (lack of right level abstractions) that causes majority of the problems including duplication and conditional complexity.
使用诸如pmd的CPD或CheckStyle这样的静态分析工具,您能够将整个分析过程作为自动构建的一部分,持续分析,确定代码重复度高的区域。
By using a static analysis tool such as PMD's CPD or CheckStyle, you can determine areas of high code duplication on a continual basis as part of running an automated build.
像Rails那样使用这种方法,您可以两全其美:具有较少重复的简洁代码而不会失去灵活性。
Using this approach, as Rails does, you get the best of both worlds: concise code with less repetition without sacrificing flexibility.
工厂需要大量冗长重复的代码。
在这里有许多重复的代码。
整个样式表中每行和每列都有重复的代码。
The code for each row and column is repeated throughout the stylesheet.
过滤器扩展功能将帮助提供更完整的输入评估,同时减少重复代码编写工作。
The filter extension helps provide more complete assessment of input while reducing repetitive code writing efforts.
许多代码是重复的(例如,有许多对列表的append方法的调用),这为错误创造了空间。
A lot of code is repeated (for instance, the many calls to the list append method), which creates room for error.
清单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.
每一块重复的代码都使得程序逻辑中出现错误的几率增加。
Each block of repeated code increases the chances of introducing an error into the logic.
清单5给出了通知订阅器的一个非常简单的实现(删除了重复代码)。
A simple implementation of notification subscriber (omitting repeated code) is presented in Listing 5.
RationalRobotvu脚本是由代表这些步骤的重复代码块组合起来的。
Rational Robot VU scripts are made up of repetitive code blocks that represent these steps.
对于所有重复的代码,一定会出现不一致性,因此将很难进行维护。
With all that repeated code, you're bound to have inconsistencies, and it will be hard to maintain.
最糟糕的是,您要对所编写的每一个POJO重复这样的代码序列。
What's worse is knowing you'll have to repeat this exact sequence of code in every POJO you write.
有时候,使用这种语句比嵌套的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.
样式表包含用来处理xml特性的代码,这些特性包括重复XML中的元素、元素值列表等等,显示的示例中并没有包括所有这些特性。
The style sheet includes code to handle features of the XML like repeating elements in the XML, lists of element values, and so forth, though the example shown doesn't include any of these.
可以通过调用这个标记在多个位置使用自定义标记,无需在不同的地方重复编写相同的代码。
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.
应用推荐