既存のプログラムを, 外側から見たソフトウェアの動きを変えずに内部構造を改善する活動として, 最も適切なものはどれか。
令和3年度 ITパスポート試験 問48
This question's explanation and your answers so far.
問 48
Incorrectア
Test-Driven Development (TDD) is a development method in which you write tests before the implementation code and repeat a short cycle of “write test → implement → refactor.” It refers to a way of proceeding with design and implementation, not a term for the very activity of improving the internal structure of an existing program while preserving its behavior.
Incorrectイ
Pair Programming is a development style in which two developers work together at a single terminal, one writing the code while the other reviews it as they proceed. It is a way of working aimed at improving quality and sharing knowledge, not a term for the activity of improving internal structure itself.
Incorrectウ
Reverse engineering is the activity of analyzing existing software or hardware to reveal its specification, design, and structure. Its purpose is to “extract” information from an existing artifact, not to improve internal structure.
- エ
正解 The correct answer is (エ) “Refactoring.” Refactoring refers to the activity of reorganizing and improving only the internal code structure without changing the program’s externally observable behavior (its outputs for given inputs, and its specification). By revisiting naming, consolidating duplicated code, splitting up complex processing, and so on, it improves readability, maintainability, and extensibility. The question’s description — improving the internal structure without changing the externally observable software behavior — is exactly the definition of refactoring itself.
- Refactoring = the activity of improving only the internal code structure without changing externally observable behavior (specification, inputs/outputs), thereby raising readability and maintainability.
- Distinguishing confusable development terms: Test-Driven Development = a test-first development cycle; Pair Programming = a two-person-team style of working; Reverse engineering = the activity of analyzing an existing artifact to reveal its specification and structure.