Code Clones: Copy, Paste, and ... ?

Copy-pasting source code is a common practice in software development, but it has severe downsides. Learn more about the problems of code clones and how to mitigate the risks of duplicated code for your system.

Code Duplication
What are code clones?

Copy-pasting source code is a common and efficient way of ad-hoc reuse. However, duplicated code (also known as clones) is one of the major risks for the future maintenance of the code.

  • The codebase is larger than it needs to be and changes have to be made multiple times.
  • Not knowing where the clones are leads to changes not being propagated to all copies of a code fragment.
  • Inconsistencies could be introduced unintentionally. This could turn out to be particularly expensive if the changes made are bug fixes.
Clone Management
How to deal with code clones

Modern development processes include clone management to mitigate clone-related risks.

  • Developers must have access to detailed information about clones in the code they change.
  • There has to be immediate feedback if clones are changed inconsistently.
  • Architects must be able to inspect cloning on a larger scale so that they can identify components susceptible to cloning and potentially rethink architecture decisions.
  • Analyzing clones across components or even across different applications also provides valuable insights.
Start today
Let a tool help you

Teamscale perfectly supports all perspectives of effective clone management. It feeds detailed clone information directly into the developers' IDE and allows architects to analyze cloning in the larger context and across components and applications.

More about Teamscale

Get your free Teamscale license today

See for yourself how Teamscale can help to detect and remove unwanted code clones in your system.

By submitting your data you agree to our privacy policy.

Get in touch
We are happy to help

If you would like to learn more about clones and how clone management fits into your development process, feel free to contact us. Our professionals are among the world's leading clone experts in research and practice.

Dr. Elmar Jürgens

+49 179 675 3863

Send me a message