减少数据访问层中的代码重复。
PMD的CPD:帮助发现代码重复
用CPD捕捉代码重复。
CPD报告代码重复。
这使得我可以避免代码重复,从而比使用过程语言更为优雅。
This enabled me to avoid code duplication more elegantly than I could have with a procedural language.
通过抽取公共部分放置在一个地方避免代码重复。
Avoid duplicate code by abstracting out things that are common and placing those thing in a single location.
查找重复代码的度量方法是在代码库中的类的内部和其他类之间搜索代码重复。
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.
每一块重复的代码都使得程序逻辑中出现错误的几率增加。
Each block of repeated code increases the chances of introducing an error into the logic.
映射规范本身不是持久化了的,这意味着对映射的任何更改都需要相应更改ETL代码或重复整个的映射过程。
The mapping specifications themselves are not persisted, which means any changes to the mapping would require to change the ETL code or to repeat the entire mapping process.
过滤器扩展功能将帮助提供更完整的输入评估,同时减少重复代码编写工作。
The filter extension helps provide more complete assessment of input while reducing repetitive code writing efforts.
如果缺少重要信息,则必须重新测试代码、重复执行步骤,然后重新开始研究。
If you lack vital information, you must reinstrument your code, repeat your steps, and restart your investigation.
工厂需要大量冗长重复的代码。
因此,当我去解决这些问题,我倾向于写代码,可以重复打补丁。
Thus, when I did fix them, I tended to write code to allow me to repeat that fix.
清单3给出了通知订阅器的一个非常简单的实现(删除了重复代码)。
A very simple implementation of a notification subscriber (omitting repeated code) is presented in Listing 3.
如果OR M框架为引用限制的建模提供了便利的话,这些内容会在你的数据库和应用程序代码上重复定义。
If your ORM framework offers facilities for modeling referential constraints, these are again defined both on your DB and in your application code.
这样维护起来会非常繁琐,因为代码是重复的。
This can be tedious to maintain because it imposes a duplication of code.
清单2给出了通知使用者的一个非常简单的实现(删除了重复代码)。
A very simple implementation of notification consumer (omitting repeated code) is presented in Listing 2.
当然你也可以不执行TDD方式,而进行重构以去除重复代码,使其更简单、灵活、更易于理解。
You can, however, refactor without performing TDD and still banish duplication while making the code simpler, easier to understand, and more flexible.
开发者必须重复代码中已有的信息,从而将配置和代码联结起来。
They have to repeat information already in the code in order to connect the configuration to the code.
除了最明显的复制-粘贴违规之外,在所有地方手工查找重复代码也非常具有挑战性。
Finding duplicate code manually can be quite challenging in all but the most obvious copy-and-paste violations.
除了最明显的复制-粘贴违规之外,在所有地方手工查找重复代码也非常具有挑战性。
Finding duplicate code manually can be quite challenging in all but the most obvious copy-and-paste violations.
应用推荐