liveBook · Manning

Code duplication

Code duplication is the presence of equivalent or substantially similar source code or implementation logic in multiple locations within a software system.

How 3 Manning books explain it

Software Design for Python Programmers

Duplicate code is the presence of multiple substantially similar copies of an implementation in a program.

How it is used
Diagnoses repeated implementations as a design smell during incremental object-oriented refactoring.
How deep it goes
Defines duplication, traces maintenance consequences across examples, and demonstrates shared implementations without fully specifying every refactoring.
Examples
Uses book catalogues, toy behaviors, sports reports, fundraising workflows, sports algorithms, and collection-specific player iteration.
What you can do after
Apply it via shared functions, cohesive classes, or design patterns that centralize common behavior and isolate variants.

Read how Software Design for Python Programmers explains code duplication →

Object-Oriented Software Design in C++

Code duplication is the presence of multiple copies of substantially similar implementation logic in a program.

How it is used
Uses duplication as a practical signal for finding poor design, maintenance hazards, and change leaks.
How deep it goes
Explains causes and consequences through several C++ examples, then points to shared functions, cohesive classes, and design patterns.
Examples
Illustrates duplication with book catalogues, sports reports, fundraising clients, and team reports over arrays, vectors, and maps.
What you can do after
Evaluate/understand repeated logic and consolidate it into shared functions, cohesive classes, or appropriate design-pattern structures.

Read how Object-Oriented Software Design in C++ explains code duplication →

Build Financial Software with Generative AI (From Scratch)

Code duplication is the repetition of substantially similar implementation logic in multiple places within a software system.

How it is used
Guides maintainability work while expanding ACH processing and exception views.
How deep it goes
Demonstrates duplicated methods and page logic, then applies extraction and component reuse without formal measurement or taxonomy.
Examples
Uses duplicated get_db code, ACH parsing, and a shared exceptions DataGrid component.
What you can do after
Apply it by extracting duplicated methods into helpers or reusable components and evaluating component data flow.

Read how Build Financial Software with Generative AI (From Scratch) explains code duplication →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.