Four Types of Duplication in Source Code

less than 1 minute read

  1. Imposed duplication: Developer feel they have no choice - the environment seems to require duplication.

  2. Inadvertent duplication: Developers don’t realize that they are duplicating information.

  3. Impatient duplication: Developer get lazy and duplicate because it seems easier. Every project has time pressures - forces that can drive the best of us to take shortcuts. Need a function similar to one you’ve written? You’ll be tempted to copy the original and make a few changes, who has got a time to refactor and remove duplication? If you feel this temptation, remember the hackneyed aphorism “short cut make for long delays.” You may well save some seconds now, but at the potential loss of hours later.

  4. Interdeveloper duplication: Multiple people on a team duplicate a piece of information. This is perhaps the hardest type of duplication to detect and handle that occurs between different developers on a project.

Compiled from the book “The Pragmatic Programmer” by Andrew Hunt and David Thomas. You can find detailed content in chapter 2 under subtopic “The Evils of Duplication”


Leave a Comment