Skip to content

Cloning code smell #12

@LarsAsplund

Description

@LarsAsplund

I really enjoy seeing open research based on publically available data! Well done.

I have some comments on the claim that research has showed that code cloning isn't the bad practice it is said to be.

It is true that if a bug is found in one clone you need to be aware of the other clones or the bug will remain. This is a maintenance burden and one of the reason for it to be considered a bad practice. In general any update to a clone leads to the problem of being aware of other instances.

A code snippet that is frequently cloned suggests that the snippet has a very distinct functionality and that code readability would be improved by refactoring it into a well-named function/method. Code cloning is also considered a bad small because it indicates lack of code structure.

From what I understand the referenced papers show a correlation between cloned code and lower bug frequency. Is that correlation really because of cloning or is it because of reuse? The more code is reused the more mature it becomes. This holds true even if code is reused through code sharing. I don't think they've made such a comparison but I admit I didn't read the papers thoroughly. Correlation but not necessarily the cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions