I am a strong advocate of the DRY principle:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
Are there any tools that can test a code base for the amount of DRYness and both quantify and pinpoint specific examples for correction?
DRY — Don't Repeat Yourself. According to this principle, a single piece of information should be present in only one place and in an authoritative manner in your system. To put it in simple terms avoid redundant repeated code.
November 2021) "Don't repeat yourself" (DRY) is a principle of software development aimed at reducing repetition of software patterns, replacing it with abstractions or using data normalization to avoid redundancy.
The DRY (don't repeat yourself) principle is a best practice in software development that recommends software engineers to do something once, and only once.
Duplicate code can be hard to find, especially in a large project. But PMD's Copy/Paste Detector (CPD) can find it for you!
Note that CPD works with Java, JSP, C, C++, Fortran and PHP code.
You can run it commandline, there is an ANT task, and an Eclipse plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With