Skip to content
Technology transformation expertise firm · ARDIANE Group Innovate, secure, succeed

Glossary

Refactoring: definition, small-step process and related notions

Domain

Engineering

In brief

Refactoring is the modification of a piece of software's internal structure without changing its observable behaviour, in order to make it easier to understand and cheaper to modify. It proceeds through a series of small transformations, with the software remaining in working order after each one.

Page contents

Definition of refactoring

Refactoring refers both to a technique and to each of the moves that make it up. Martin Fowler’s website refactoring.com, consulted on 12 November 2026, repeats the definition the author gives in his book “Refactoring”. The noun refers to a change made to the internal structure of software to make it easier to understand and cheaper to modify, without changing its observable behaviour. The verb refers to applying a series of such changes.

In French, usage employs “refactorisation” or “remaniement”. By observable behaviour, this entry means what a user or a calling program can see: results, messages, stored data.

Martin Fowler credits the technique with one effect: containing the cost of changes, which additions piled one on top of another make increasingly difficult. He says he restructures the code before adding a feature, so that the addition becomes simple, then after making it work, so that the code can be understood on rereading. It is one of the ways of paying down technical debt as you go.

A series of small verified transformations

The refactoring.com home page describes the heart of the technique: a series of small behaviour-preserving transformations. Each does little, and their sequence can produce a significant restructuring. The system remains in working order after each transformation, which reduces the risk of breaking it.

The website’s online catalogue names these transformations, including “Extract Function”, “Rename Variable” and “Move Function”.

Some development environments automate part of these moves. Martin Fowler considers them useful without regarding them as indispensable: failing that, he proceeds in small steps and tests frequently. When the code has no tests, characterisation tests, presented in our article on automated testing, first pin down the existing behaviour. Without a means of verification, preserving behaviour remains an intention.

Refactoring, rewriting, redesign, optimisation: not to be confused

Usage distinguishes these four operations by what changes and by what must remain identical.

Operation What changes What remains identical
Refactoring The internal structure of the code Observable behaviour
Rewriting The code, replaced by new code The service provided, to be demonstrated afresh
Redesign The functional scope, user journeys or architecture What the project decides to keep
Optimisation Response time or resource consumption The functional result; readability may suffer

Martin Fowler specifies that refactoring is not another word for cleaning up code: he reserves the term for this technique and uses “restructuring” as a more general term, for a reorganisation of the code that may use other techniques. Fixing a defect does not fall under it either, since it changes behaviour. As for a rewrite carried out in stages, it falls under a migration pattern, the strangler fig pattern.

The table also marks the limit of the practice. Understood in this way, refactoring changes neither the technical foundation nor the functional scope: a technology reaching end of support or a new need calls for other operations.

Example: an invoicing function nobody dares to touch

Consider an energy supplier’s invoicing application. A single function calculates consumption, applies the tariff, adds taxes and formats the invoice. A tariff option has to be added to it.

The team first writes tests that record the invoices produced for a set of contracts. It then extracts the consumption calculation into a named function, reruns the tests, then does the same for the tariff and for taxes. At each step, the invoices remain identical. The tariff option is then added in a short function, through a change separate from the previous ones.

Applied to an entire application estate, refactoring becomes one route among others, from encapsulation to replacement: our application modernisation page explains how to choose, and the safety net of tests it requires falls under software quality.

FAQ

Frequently asked questions

Another question? Ask us

What is refactoring?

Refactoring consists of modifying the internal structure of a piece of software without changing its observable behaviour. According to Martin Fowler's definition, published on refactoring.com, the aim is to make the software easier to understand and cheaper to modify. The technique proceeds through small successive transformations, with the software remaining in working order after each one.

What is the difference between refactoring and rewriting?

Refactoring keeps the existing code and modifies its structure in small steps, with observable behaviour remaining identical at each one. Rewriting replaces the code with new code, whose behaviour must be demonstrated afresh. A rewrite can itself be carried out in stages, following the strangler fig pattern.

Do you need automated tests to refactor?

Refactoring requires a way of checking, after each transformation, that the software's behaviour has not changed. Automated tests rerun at each step fulfil this role. Martin Fowler states on refactoring.com that, in languages lacking an automated refactoring tool, he relies on small steps and frequent testing to detect errors.

Should refactoring appear in a project plan?

Martin Fowler writes on refactoring.com that refactoring is not a special task to show in a project plan: done well, it is an ordinary part of programming activity. A large-scale restructuring, such as decoupling a module, may however require an identified piece of work, arbitrated with the product owner.

A project to bring to completion?

A first conversation is enough to understand your challenge, identify the right people and tell you frankly what we can bring.