リファクタリングの説明として, 適切なものはどれか。
令和5年度 ITパスポート試験 問49
This question's explanation and your answers so far.
問 49
- ア
正解 Refactoring means reorganizing and improving only the internal structure of a program (such as code organization, naming, and removing duplication), without changing at all the functional specifications that the software provides externally (the outputs or behavior in response to inputs), thereby raising maintainability and readability. Choice ア states exactly “improving the internal structure without changing the functional specifications,” which is the very definition of refactoring, so it is correct.
Incorrectイ
“Analyzing the behavior of software and clarifying its specifications” describes reverse engineering. It is a technique that works backward from an existing product or code to uncover its design and specifications, and its purpose differs from refactoring, which improves the internal structure.
Incorrectウ
“Fixing software defects so that it works according to its specifications” describes bug fixing (debugging / corrective maintenance). It corrects erroneous behavior, which is different from refactoring, which only tidies up the internal structure without changing behavior.
Incorrectエ
“Making modifications that add new functions based on user requests” describes adding functionality (perfective maintenance / feature extension). It is a change that increases the externally visible functional specifications themselves, which is the opposite in nature to refactoring, which does not change the functional specifications.
- Refactoring = improving only the internal structure to raise maintainability and readability, without changing the externally visible functionality (behavior / specifications).
- Distinguishing it from similar terms: working backward to recover specifications is reverse engineering, fixing defects is bug fixing, and adding new functions is adding functionality.