I ran into this comment in some code and just had to laugh (and refactor it).
/** * Note: The code has some copy/paste code. Because it can't integrate to a method. * The parameter painter can't be changed when drawing. * If it newly twice when drawing, the text may not be shown. */
The code was written by a very, very junior programmer. It turns out that he was wrong about being unable to refactor it. He just needed to create a new class. The code that he wrote was unmanageable and led to bugs. When fixing an issue on one side, you had to remember to fix it on the other side. Refactoring it led to half the code to maintain and a class that could be used again.
I talked to programmer for a large company in Reno who spent most of his time looking for copy and pasted code. It was his job to refactor it into a library.
So please for my sanity’s sake, don’t copy and paste code on the off chance I have to work on it. If you feel the need to copy and paste, chances are it should be in a common class or a library somewhere.