Object Oriented Software Engineering   View all facts   Glossary   Help
subject > practice > duplication of code
Next practiceencapsulation    Uppractice    Previous practicetesting strategy   

duplication of code
(cloning)
subjectfact 
duplication of codeis a synonym of cloning2001-08-30 14:54:54.0
can be avoided by creating a common superclass if the duplication occurs in two separate classes2001-08-30 14:55:23.0
can be avoided by creating a separate method that has the common code, and calling it from the original location and any other needed locations2001-08-30 14:55:23.0
has disadvantage when there are two or more occurrences of the same or similar code in the system, any changes made (e.g. to fix defects) will have to be made in all clones2001-08-30 14:55:23.0
is not a kind of reuse2001-08-30 14:55:23.0
is a subtopic of Programming Style Guidelines2001-08-30 14:55:23.0
is a kind of practice2001-08-30 14:55:23.0
should be avoided because it increases the total volume of code and means that if you change the code in one place, then you might forget to change the code in the other places2001-08-30 14:55:23.0