Code-Kitten
I nomz teh codez fur u!
Code-Kitten helps you find high-level patterns that often make code buggy, slow, and hard to manage.

Code-Kitten is fast and frisky. Code-Kitten doesn't like repeated fluff and sluggish bottlenecks. Code-Kitten wants to maxamize treats and playtime.

Code-Kitten is great at looking for bits of duplicate code within a file. Using the same code twice upsets Code-Kitten because it introduces bugs later if only one section of the code is updated. Proof: 11 out of 10 cats agree that modular non-duplicate code is a good thing (and yes, Code-Kitten's vote counts twice).

Check out the examples or paste in some code below to level up.
Example Duplicate Code
Non-Duplicate Code
Big and Messy
Big and Clean
<your code>
Still not convinced?

Here's the general consensus on Wikipedia.
Code duplication is generally considered a mark of poor or lazy programming style. Good coding style is generally associated with code reuse. It may be slightly faster to develop by duplicating code, because the developer need not concern himself with how the code is already used or how it may be used in the future. The difficulty is that original development is only a small fraction of a product's life cycle, and with code duplication the maintenance costs are much higher. Some of the specific problems include:

  • Code bulk affects comprehension: Code duplication frequently creates long, repeated sections of code that differ in only a few lines or characters. The length of such routines can make it difficult to quickly understand them. This is in contrast to the "best practice" of code decomposition.

  • Purpose masking: The repetition of largely identical code sections can conceal how they differ from one another, and therefore, what the specific purpose of each code section is. Often, the only difference is in a parameter value. The best practice in such cases is a reusable subroutine.

  • Update anomalies: Duplicate code contradicts a fundamental principle of database theory that applies here: Avoid redundancy. Non-observance incurs update anomalies, which increase maintenance costs, in that any modification to a redundant piece of code must be made for each duplicate separately. At best, coding and testing time are multiplied by the number of duplications. At worst, some locations may be missed, and for example bugs thought to be fixed may persist in duplicated locations for months or years. The best practice here is a code library.

  • File size: Unless external lossless compression is applied, the file will take up more space on the computer.