O'Reilly logo

Refactoring Workbook by William C. Wake

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Duplication

Note

“You can say that again!”

Duplication has been recognized for more than 30 years as the bane of the programmer's lot. How does duplication cause problems?

  • There is more code to maintain (a conceptual and physical burden).

  • Parts that vary are buried inside the parts that stay the same (a perceptual problem—it's hard to see the important stuff).

  • Code variations often hide deeper similarities—it will be hard to see the deeper solution among all the similar code.

  • There's a tendency to fix a bug in one place and leave identical bugs elsewhere unfixed. When you see two variations of something, it's hard to know which variation is the right pattern or if there's a good reason for the variations.

David Parnas introduced the idea of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required