A common feature of many IDE are templates, which greatly speed writing code. People often create their own “cut-and-paste” templates as well.
An important rule to remember here is that no template should ever “work” out of the box. This way, if (for whatever reason!) you don’t fill it in, you know it will fail fast. This helps avoid bugs that can be quite subtle: template code which fails slowly. 🙂
In Java IDEs, for example, I configure the template used for new methods to throw a
When I use TDD-techniques to write code, the usual procedure is to fill out (part of) the test case, and fix the compile errors. “Fixing the compile errors” may sometimes involve creating several methods. By using the “broken” template, I can easily just run my test, and fill in the methods as I go.
Similarly, if you’re using cut-and-paste (which is sometimes valid), don’t cut-and-paste something that works; cut and paste something that is blatantly wrong – make a parameter something like “CHANGE_ME”, or introduce a deliberate syntax error. That way, when you customise the cut-and-paste template, you can fix the error as you go.
 An example of “valid” cut-and-pasting occurs when doing TDD, particularly for testing validation rules. The tests in these scenarios are often fairly repetitive.