200-901 · Question #174
Why would a developer compare a current version of code to a previous version?
The correct answer is B. to troubleshoot code failures. Comparing current code to a previous version is a fundamental practice for troubleshooting, as it helps identify specific changes introduced between versions that might have caused new errors or regressions.
Question
Why would a developer compare a current version of code to a previous version?
Options
- Ato track who made a change
- Bto troubleshoot code failures
- Cto aid collaboration
- Dto provide the single source of truth
How the community answered
(34 responses)- A18% (6)
- B74% (25)
- C6% (2)
- D3% (1)
Why each option
Comparing current code to a previous version is a fundamental practice for troubleshooting, as it helps identify specific changes introduced between versions that might have caused new errors or regressions.
While version control systems track who made changes, comparing code directly is primarily for understanding what changed, not just who changed it; `git log` or similar commands are better for tracking authors.
When code fails, comparing the current version to a known working previous version allows a developer to quickly identify specific modifications, additions, or deletions that correlate with the failure. This process helps pinpoint the exact change responsible for the issue, making debugging more efficient.
Comparing code can indirectly aid collaboration by making changes visible, but its direct purpose is not to aid collaboration but rather to review and understand differences, often for debugging or merging.
A version control system itself, rather than the act of comparing versions, provides the single source of truth for code; comparing is an operation on that source.
Concept tested: Version control usage - troubleshooting
Source: https://git-scm.com/docs/git-diff
Topics
Community Discussion
No community discussion yet for this question.