What is duplication?

What Does duplication Mean

The Latin word duplication came to our language as a duplication . It's about the act and result of doubling : multiplying something by two or making it double.

For example: "To minimize traffic congestion in the downtown area, the municipal government announced the duplication of the Avenida Centenario road" , "I have to duplicate the DVD as soon as possible: I don't want to lose this material for any reason " , " According to several economists, doubling the electricity rate will make the prices of all goods produced in the country more expensive . "
DNA duplication is called the process that allows deoxyribonucleic acid to duplicate, synthesizing an exact copy. This means that, from a DNA molecule , two replicas are generated .

A genetic mutation that occurs when one or more nucleotides are repeated in the DNA sequence is also called duplication . Expressed in another way, chromosome duplication is a phenomenon that involves the repetition of a part of the chromosome .
This mutation occurs within the framework of DNA duplication. An erroneous crossover or a certain structural reorganization can cause the disorder. Chromosomal duplication is not visible to the naked eye: it requires molecular and cytogenetic studies.
Finally, in the field of computer programming, code duplication occurs when the same source code sequence appears more than once in the same program . This type of sequence is called a clone and can cause a number of inconveniences, such as a larger file size.
Software developers consider duplication an "undesirable" situation, as it leads to unnecessary complications and is opposed to the concept of optimization . It should be mentioned that two portions of a code file, or the code of an entire program, can be very similar without being considered clones: in these cases, we speak of a « coincident similarity ».
For two code sequences to fall into the duplication category, at least one of the following conditions must be met:
* that are equal to one hundred percent, without exception;

* that are identical once comments and blanks are ignored;

* that all its tokens (lexical components that have a consistent meaning in a given programming language ) are identical;

* that the previous point is met, although with certain occasional variations;

* that are identical in functionality.

Since code duplication is considered so negative by programmers, it is difficult to understand why anyone would engage in this practice. In general, it is associated with the action of " copy and paste", and occurs in very neglected projects, generally in prototypes, where optimization is not sought but the achievement of results in the shortest possible time.
Programming experts criticize those who make this mistake as lazy, since the recommended development style focuses on reusing the code. It is important to note that duplicate code makes it more difficult for third parties to understand, but also for the creator himself.
Let's look at a practical example of how to avoid code duplication. Suppose we are developing a word processor and we want to include a tool to copy the format of one text string to another (each one can consist of one or more characters). In general, programs of this type allow you to do it in two ways: by copying the format only once, or by keeping the associated button active to make as many copies as you want until finally deactivating it.
In the code, the ideal would be to create a function in which all the steps are carried out to copy the format of a string, and then "call" it from each part of the file in which we need it, either for the single copy or multiple. It would be a waste of space to duplicate this piece of code in each of those sections.

Go up