Code Maintenance CS Thinking Example 4
Follow the full solution, then compare it with the other examples linked below.
Example 4
hardExplain the term 'technical debt' and give two examples of how it accumulates. How does it affect long-term code maintenance?
Solution
- 1 Step 1: Technical debt is the implied cost of future rework caused by choosing quick, easy solutions now instead of better approaches. Like financial debt, it accumulates interest.
- 2 Step 2: Examples: (1) Copy-pasting code instead of creating a reusable function โ every bug must be fixed in every copy. (2) Skipping tests to meet a deadline โ bugs discovered later are harder and more expensive to fix.
- 3 Step 3: Accumulated technical debt slows development (more time debugging), increases bug rates, and can eventually make the codebase so complex that rewriting it from scratch becomes necessary.
Answer
Technical debt: shortcuts now that cost more later. Examples: duplicated code, skipped tests. It slows development and increases bugs over time.
Technical debt is a crucial concept in professional software development. Successful teams actively manage it by dedicating time to refactoring and preventing it from growing unchecked.
About Code Maintenance
The ongoing process of updating, fixing, and improving software after its initial release to correct bugs, adapt to new requirements, improve performance, and keep dependencies current. Maintenance includes four types: corrective (fixing bugs), adaptive (adapting to new environments), perfective (improving functionality), and preventive (reducing future problems).
Learn more about Code Maintenance โMore Code Maintenance Examples
Example 1 easy
A program uses the number 0.2 (tax rate) in 15 different places. Why is this a maintenance problem,
Example 2 mediumList four practices that make code easier to maintain, and explain why each helps.
Example 3 mediumIdentify three maintenance problems in this code: x = INPUT(). y = x * 0.175. z = x + y. OUTPUT z. R