Refactoring is the task of changing code to make it more readable, more maintainable, while not changing it's behavior at all.

The simplest example I usually give is that of changing a variable name to be meaningful.

We all know that naming things is really hard so when we write code and we read in some data we can easily start using meaningless variables. For example $x, $data, or $temp. We might finish our implementation, the code starts doing what we expected it to do, but we still have these meaningless variables.

When a few days or month later we need to come back to make changes we'll be baffled by the meaning of these variables.

It is better to change them to something meaningful to make it easier to read and understand the code.

The process of these changes is called refactoring. In this series of articles we are going to see how to do that.