A method, apparatus, system, and signal-bearing medium that in an
embodiment determine whether a block of code associated with a
copy-and-paste operation or a punch-out operation has a size greater than
a threshold. If the size is greater than the threshold, then a method is
created and the block of code is pasted into the method. Also, an
invocation to the newly created method is added at the copied-from
location and the intended pasted-to location (in the case of the
copy-and-paste operation) or an invocation to the newly created method is
added at the copied-from location (in the case of the punch-out
operation). In this way, future modifications to the block of code need
only be made in one place: the method, instead of at all locations where
duplicate code exists. Thus, embodiments of the invention may reduce the
fragility of the code.