Skip to content
← Back to glossary

リファクタリングRefactoring

Learn in the textbookAgile Development and XP Practices

DefinitionRefactoring (リファクタリング) is the work of reshaping a program's insides, such as names and structure, so it is easier to read and change, without altering its external behavior.

ExplanationExternal behavior here means the results returned for the same input and what users can see the program do. Even when that stays the same, removing duplication or splitting up the logic makes later fixes and new features easier. Running the tests after the cleanup confirms the behavior has not changed.

AnalogyIt is like tidying a room without throwing anything away, just re-dividing the drawers so things are easier to find.

Memory hookThink of re-factor as redoing a factorization in algebra: the value stays the same, and only the form of the expression is rearranged.

Related past-exam questions(4 questions)