Practice Code Maintenance in CS Thinking
Use these practice problems to test your method after reviewing the concept explanation and worked examples.
Quick Recap
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).
Software is never 'done.' Like a garden, it needs constant tending โ fixing bugs, updating dependencies, and adapting to changing needs.
Example 1
easyA program uses the number 0.2 (tax rate) in 15 different places. Why is this a maintenance problem, and how should it be fixed?
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. Rewrite it with better practices.
Example 4
hardExplain the term 'technical debt' and give two examples of how it accumulates. How does it affect long-term code maintenance?