Copy-Paste-Itis

Published: {ts '2011-08-15 00:00:00'}
Author: Steven Neiland
Site Url: http://www.neiland.net/article/copy-paste-itis/

Do you or someone you know suffer from CopyPasteItis? Do you know the warning signs? What do you do if you have it?

What is CopyPasteItis

CPI is an insidious disease which affects many developers and systems today. Unlike normal bugs, CopyPasteItis or CPI is not in of itself an error in a program. Rather CPI is an infection which only programmers are susceptible to.

CPI causes uncontrolled code duplication using the Copy - Paste facilities of modern computers and can result in huge code files, error duplication and maintenance nightmares.

Symptoms of CPI

Primary symptoms of CPI include an aversion to 'Source Control', an unnatural fear of 'Unit Tests' and reluctance to participate in coder community activities such as code reviews.

Secondary symptoms can include code files which rapidly grow in size. Numerous instances of the same error appearing in disparate parts of an application, and finally a high turnover of maintenance programmers.

How is it Spread

While CPI has been linked with the code writing gene which all programmers are born with, it is actually more closely related to the 'Lazy' and 'Good Enough' genes when you look at it under a microscope. For this reason it is not so much spread as activated.

How Is CPI Activated

CPI can become activated in a programmer for many reasons. Normally the activator is the programmers own personality/work ethic, however it can also be the result of outside influences such as;

Excessive Workload

The most common activator of CPI in an otherwise healthy programmer is excessive work load and unrealistic expectations. This requires that management must be aware of the workload a developer is under and be willing to manage expectations so that developers do not burn out.

Managing workload is probably the easiest way to reverse CPI but is also the least commonly used method.

Lack Of Peer Reviews and Positive Reinforcement

Another common activator is lack of positive management oversight. Any developer, no matter how skilled or diligent will fall into the CPI trap if management do not take an active role in positively reinforcing good coding standards. This is especially true in small departments where developers may not have adequate peer review opportunities.

Note that I say positive reinforcement because unhappy developers will never improve, while developers who feel appreciated will want to improve in (90% of cases).

How Is CPI Activated - cont.

Outside Stress

As with all people, developers are affected by outside stress in their lives, but because the nature of their work requires a level of creativity this can be doubly problematic.

While this cannot be dealt with directly, if you give your developers a calm positive work environment the affects can be reduced.

Warning Signs To Look Out For

When looking for CPI the first and post prominent warning sign will often be that a programs code base is rapidly growing in size relative to the number of developer hours being spent on a system.

Another sign to look out for is ambiguous names for variables or variables whose name do not relate to the function of that code group.

Finally a strong warning sign will be friction with other developers. This is particularly true of maintenance programmers who are subjected to the results of CPI more than any other person and will over time react accordingly.

Results of Untreated CPI

If left untreated CPI will result in a code-base which rapidly grows in size while at the same time duplicating and increasing the damaging potential of code bugs.

Maintenance will become almost impossible with error fixes and updates having to be replicated numerous times throughout the working code of a program.

In extreme cases a system can become so unstable as to require a complete rewrite or replacement.

How To Treat CPI

As mentioned before, the key to treating and preventing CPI is active positive management participation. Peer code reviews should be encouraged with an emphasis on open discussion about improving the code rather than negativity about problems identified.

Finally workloads should managed by management not the developers themselves so that developers do not get burned out and demotivated and management is seen as a positive rather than a negative.

It is important to realise that 99% of developers who suffer from CPI want to get better, they just either do not recognize they have CPI or lack the resources to deal with the issue themselves.