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) are 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 done multiple times.
  • Not knowing where the clones are leads to changes not being propagated to all copies of a code fragment.
  • Inconsistencies are unintentionally introduced and become particularly expensive if changes 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 to identify components susceptible to cloning and potentially rethink architecture decisions.
  • Analyzing clones between components or even between different applications provides also valuable insights.
Start today
Let a tool help you

Teamscale perfectly supports all perspectives of effective clone management. It feeds detailed clone information directly in to the IDE of the developers and allows architects to analyze cloning in the large and between components and applications.

More about Teamscale

Get your free Teamscale license today

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

By submitting your data you confirm that you agree to our privacy policy.

Get in touch
We are happy to help

If you would like to know 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