1)Copy
2)Paste
At least every time they are used in combination a big alert should pop-up listing the other available refactorings, with a random chain of "Are You Sure" dialogs popping up if the developer trys to continue.
Cut and Paste are the source of way to many AntiPatterns
Posted by rob@rojotek at May 29, 2003 10:36 AMMaybe some sort of workflow or alerting process to enable the technical leads on a project to approve/reject, or at least be aware of all of the cut and paste activity.
(Could this be the opportunity that JMS has been waiting for...?!)
Take a look at PMD over at SourceForge. They have a tool bundled in that can help discover cut and pasted code. That would help give leads the visibility into when folks are doing something ill advised. PMD's other functionality looks pretty impressive, too.
Posted by: cmdln at May 29, 2003 02:15 PMI dunno, using copy/paste and search/replace together is a great way to crank out code that is not similar enough to benefit from standard s/w engineering re-use (e.g. procedures, OO, whatever).
Posted by: Dave at May 29, 2003 04:30 PMFar from being an AntiPattern, I believe that premature attempts at finding reuse because of a fear of Copy and Pasting are the AntiPattern. Agreed, if you're copy and pasting without changing anything, then your object's responsiblities are screwy but if you are changing something, it's better to copy and paste the first few times, find out where the code needs to be flexible and then start looking at refactoring for reuse.
Posted by: Sean Renaults at May 29, 2003 08:06 PM