Information Technology Reference
In-Depth Information
FIGURE 7-4
PMD report
Reduce Duplicate Code
Too often developers opt to copy and paste code rather than determin-
ing better ways to generalize, reuse, or abstract behavior. This problem
of code duplication has existed since the first programs were written;
moreover, researchers and developers alike have been working to elim-
inate the need to duplicate code for many years. Improvements to pro-
gramming constructs—such as the introduction of procedural
programming, object-oriented programming, and more recently,
aspect-oriented programming—have all helped to reduce the need to
duplicate code. However, the urge to copy and paste will always
exist—and often, the problem is that the developer just doesn't realize
he's doing it.
Copied-and-pasted code can occur in all areas of the system in one
form or another, including
• Database logic, including stored procedures and views—for
example, SQL
• Compiled source code—for example, Java, C, C++, and C#
 
Search WWH ::




Custom Search