Code Clone
Management
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.

Copy, paste, and ...?

Handle code duplication in a practical way

1, 2, 3, ...
Copies
52%
Defects
3 PD
Cost per defect

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 problem with clones

Clones make your codebase unnecessarily large and require you to apply changes multiple times. Not knowing where the clones may cause you to inadvertently introduce inconsistencies, which might turn out particularly expensive if the changes fix a defect.

In a study with Munich Re and LV1871 we found that 52% of all unintentional inconsistencies between clones are defects.

Code Clone Highlighted

Clone Management

For developers

As a developer, you need access to detailed information about clones in the code you change. And you need immediate feedback, if you change clones inconsistently.

For architects

As an architect, you must be able to inspect cloning on a larger scale, to identify patterns and potentially rethink architecture decisions.

See Soft View_cropped

Stay Alert

See clones while working

Teamscale not only comes with a best-of-class code-clone detection, it also shows you clones directly in your IDE or your merge request.

Get notified about inconsistencies

When you change a clone inconsistently, Teamscale immediately warns you about all remaining copies, so you can investigate whether those should be changed, too.

Clone Alert_cropped

Check Boundaries

Detect cross component clones

Teamscale identifies duplication across different components of your system, to help you find candidates for common infrastructure. You may freely specify what your components are, using Teamscale’s architecture modeling.

Detect cross system clones

Teamscale may also identify clones across entire applications, to help you build and manage common infrastructure for your whole portfolio.

Clone System View_rounded corners

Start Clone Management Today

Quick and easy setup

Setting up clone management is usually possible in a matter of a few hours.

Eliminate recurring defects

In a study with Munich Re and LV 1871, we found that 52% of all unintentional differences between clones were defects. Clone management would’ve prevented all of them!

Save costs for fixing defects

Thanks to clone management, Munich Re saves about 500 person days annually for fixing defects and has 6% lower effort overall, due to avoided duplication.

Clone_Null Pointer Code_ cropped
Support

FAQs

Everything you need to know about clone management. Can’t find the answer you’re looking for? Please chat to our friendly team.

What is a code clone?

A clone is a piece of code that exists as separate copies at least twice in your codebase.

Why are clones problematic?

* Because duplication means you have more code to maintain.
* Because, not knowing where all the copies are, you may involuntarily introduce costly inconsistencies, such as fixing a defect in one clone but not another.

Should I refactor all our clones?

While the textbook answer is ‘Yes’, we acknowledge that doing so might imply huge and risky changes. Therefore, we recommend Clone Management to control the risk and decide where it is appropriate to refactor – and where it isn’t.

Can Teamscale find clones across applications?

Yes. Teamscale may find clones across components or entire applications.

Experience Exchange

Would you like to exchange experiences on Clone Management?

I have worked with Clone Management for over 15 years. In research papers, speaking at industry conferences, talking to developers and software architects, and working with customers who have been using it for years.

If you would like to learn more about clones and how clone management fits into your development process, I’m happy to chat.

image 31-1
Start using Clone Management

Start avoiding regressions and saving effort today

Up to date

Latest writings

The latest news, events and insights from our team.

  • Events
  • Publications
  • Cases
  • Blog
Trusted by the best teams
logo_lv1871_transparent
logo_baybg
BMW_logo_(gray).svg
logo_siemens_cropped
logo_fujitsu
logo_dmTECH
logo_swm
logo_p7s1
logo_datev
logo_seidenader
logo_vkb