We're using a code static analysis tool (Sonar) to detect duplicate code on our project. It appears that there are a great many instances of duplicates in the code but most of them are less than 10 lines and occur only once. In the 'opinion' of the Stackoverflow community, Where should you draw the line at consolidating code duplications? For example should it be at >= 10 lines for individual duplicates or should you consider overall number of lines duplicated eg. consider > 10 duplicates that occur more than once. For context the programming languages I'm looking at are Java and ActionScript. I realize that this question may not come to a definitive answer but some clear guidance on this matter could save me a lot of time refactoring code (or increase the time:)
If they are actual duplicates, consolidate as soon as you can. The longer you leave it, the more the copies will diverge and the harder it will be. Also, when someone comes across a pile of copies and needs to do a "quick fix" they will make more copies, but a nice clean codebase encourages everyone to keep it clean.
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