In the O'Reilly book on Scala, I read that copy-pasting of code creates:

... creates issues of code-bloat, maintainability and skew,

I can't see any obvious definitions of the word skew in context. I am aware of the problems of copy-pasting, but I can't make them fit with the word 'skew'. Since this is used in an O'Reilly book I'm guessing it's a real programming term in circulation.

Any pointers?


2 Answers 2


Skew in its most traditional definition means out of alignment (not parallel). Obviously when code is copied and pasted the two copies are identical and parallel. This is not an invariant. Changes made to one copy is not guaranteed to make it to the other copy (due to carelessness or ignorance). Now there are two versions of code existing in two different places that are skewed (no longer the same). This can lead to weird bugs when behavior seems to work in one place and not in the other. Keep your code DRY (don't repeat yourself).

EDIT/ADDITION: If you have an urge to copy and paste, more than likely what you should do is abstract the code you are copying into a shared superclass (object oriented) or some sort of included utility function (functional).

  • +1 for a good explanation. Also for some catharsis - I have to deal with a codebase that consists of hundreds and hundreds of lines of copy-paste code with exactly this kind of problem, which needs to be fixed.
    – KChaloux
    Commented Feb 18, 2013 at 14:46

Ever play the game Telephone as a kid? You know, the one where each person whispers a phrase to the next person in line and at the end, the last person says the phrase out loud and everyone laughs at how different it has become from the original? That's skew. When you copy and paste code, you inevitably make small changes in one or more of the copies. And the more often you copy and paste the same code, the more the changes build up and the code gets skewed away from the original. I've seen code with hundreds of copy and pasted blocks, each varying from the other by just a few characters, it's nearly impossible to maintain. If you find yourself wanting to cut and paste a section of code, you should probably at least consider putting it into its own function.

  • 3
    The differences are not caused by the copy-and-paste. They are caused what happens after the copy-and-paste.
    – Stephen C
    Commented Feb 17, 2013 at 4:43
  • 1
    Quite true, but if the code hadn't been copied and pasted, the differences would not have occurred.
    – Jim Nutt
    Commented Feb 17, 2013 at 17:18
  • It's a good example, but the analogy is skewed from the concept. In the analogy, the paste creates a different copy, while in the actual concept, the copy is same, but is not synchronized, hence causing the skew.
    – Sundeep
    Commented Dec 12, 2013 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.