Duplicate code

code duplicationduplicated codeDuplicationclone detectioncode cloneduplicateduplicate objectsduplicatedduplicatesduplication of code
Duplicate code is a computer programming term for a sequence of source code that occurs more than once, either within a program or across different programs owned or maintained by the same entity.wikipedia
72 Related Articles

Code refactoring

refactoringrefactoredrefactor
Refactoring duplicate code can improve many software metrics, such as lines of code, cyclomatic complexity, and coupling.
For example, the method at hand may be very long, or it may be a near duplicate of another nearby method.

Computer programming

programmingcodingprogrammable
Duplicate code is a computer programming term for a sequence of source code that occurs more than once, either within a program or across different programs owned or maintained by the same entity.
Unreadable code often leads to bugs, inefficiencies, and duplicated code.

Code smell

code smellssmellssymptoms
Duplicate code is generally considered undesirable for a number of reasons.

Copy-and-paste programming

Copy and paste programmingcopies some program codecopy and pasting
*copy and paste programming, which in academic settings may be done as part of plagiarism
Being a form of code duplication, copy-and-paste programming has some intrinsic problems; such problems are exacerbated if the code doesn't preserve any semantic link between the source text and the copies.

Source lines of code

lines of codeLOCSLOC
Refactoring duplicate code can improve many software metrics, such as lines of code, cyclomatic complexity, and coupling.
Furthermore, inexperienced developers often resort to code duplication, which is highly discouraged as it is more bug-prone and costly to maintain, but it results in higher SLOC.

Brenda Baker

Baker
She is known for Baker's technique for approximation algorithms on planar graphs, for her early work on duplicate code detection, and for her research on two-dimensional bin packing problems.

Abstraction principle (computer programming)

abstraction principleAbstraction principle (programming)abstraction
In software engineering and programming language theory, the abstraction principle (or the principle of abstraction) is a basic dictum that aims to reduce duplication of information in a program (usually with emphasis on code duplication) whenever practical by making use of abstractions provided by the programming language or software libraries.

Subroutine

functionfunctionssubroutines
If the function is not inlined, then the additional overhead of the function calls will probably take longer to run (on the order of 10 processor instructions for most high-performance languages).

List of tools for static code analysis

List of tools for static code analysis, JavaScriptStatic code analysis toolsautomated tool

Rule of three (computer programming)

the rule of three
Duplication is considered a bad practice in programming because it makes the code harder to maintain.

Source code

codesourcesource file
Duplicate code is a computer programming term for a sequence of source code that occurs more than once, either within a program or across different programs owned or maintained by the same entity.

Lexical analysis

tokenslexical analyzertoken
Two code sequences may be duplicates of each other without being character-for-character identical, for example by being character-for-character identical only when white space characters and comments are ignored, or by being token-for-token identical, or token-for-token identical with occasional variation.

Plagiarism

plagiarizedplagiarizingplagiarised
*copy and paste programming, which in academic settings may be done as part of plagiarism

Vulnerability (computing)

vulnerabilitiesvulnerabilitysecurity vulnerabilities
When code with a software vulnerability is copied, the vulnerability may continue to exist in the copied code if the developer is not aware of such copies.

Cyclomatic complexity

Synchronization complexitycode complexitycomplex
Refactoring duplicate code can improve many software metrics, such as lines of code, cyclomatic complexity, and coupling.

Coupling (computer programming)

couplingdependenciesdependency
Refactoring duplicate code can improve many software metrics, such as lines of code, cyclomatic complexity, and coupling.

Cognitive load

cognitive workloadcognitive load theorymental workload
This may lead to shorter compilation times, lower cognitive load, less human error, and fewer forgotten or overlooked pieces of code.

Human error

Engineer errorerrorerrors
This may lead to shorter compilation times, lower cognitive load, less human error, and fewer forgotten or overlooked pieces of code.

Simultaneous editing

multiple simultaneous edits
Clones may be the most effective solution if the programming language provides inadequate or overly complex abstractions, particularly if supported with user interface techniques such as simultaneous editing.

Rabin–Karp algorithm

Rabin–Karp string search algorithmRabin-Karp string search algorithmKarp–Rabin string search algorithm