The Dirty Secret of Copy-Paste

While visualizations are important to get the overall picture, the numbers from an X-Ray analysis often provide more details that help uncover design issues. The next figure shows the detailed results from the X-Rays of LinkTagHelperTest.cs and ScriptTagHelperTest.cs.


The table in the preceding figure presents an interesting finding. We see that several methods have a high degree of code similarity. That is, the implementation of several methods is very similar, which is an indication of copied-and-pasted code. For example, the highlighted row shows that there’s a code similarity of 98 percent between two methods ...

Get Software Design X-Rays now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.