ACM-SW study materials
ACM-SW study resources

Code Review and Technical Debt in a Legacy System

ACM-SW · Put your knowledge to work in context.

All case studies

Code Review and Technical Debt in a Legacy System

A legacy Java application (10 years old, 500k LOC) is being maintained by a team of 4 developers. The codebase has no automated tests, uses outdated libraries, and has inconsistent coding styles. The team is asked to add a new feature that requires integrating with a REST API. During code review, a senior developer notices that a junior developer has copied a large block of code from another part of the system (duplicating logic) and used a deprecated library for JSON parsing. The junior developer argues that this was the fastest way to meet the deadline and that the copied code is already tested in production. The project manager is under pressure to deliver quickly.

1. What are the risks of accepting the junior developer's code as is, and what would you recommend?

Read the worked answer

Risks: Duplicated logic increases maintenance burden and risk of inconsistent bug fixes; deprecated library may have security vulnerabilities and lack support; no automated tests means regressions likely; technical debt accumulates, slowing future changes. Recommendation: Reject the pull request. Instead, refactor the duplicated logic into a shared utility (with tests) and replace the deprecated library with a supported one. If deadline is tight, allow a temporary workaround but create a tech debt ticket with high priority and schedule immediate follow-up. Pair the junior with a senior to implement properly. Emphasize long-term cost of shortcuts.

2. How could the team improve construction practices to prevent similar issues?

Read the worked answer

Introduce mandatory code reviews with checklists including duplication and library usage. Establish coding standards and enforce with static analysis tools (e.g., SonarQube). Add automated tests for new code and gradually for critical legacy code. Create a shared library for common utilities. Provide training on refactoring and design patterns. Use dependency management to track outdated libraries and plan upgrades. Adopt a definition of done that includes tests and no new tech debt.