This new refactoring called inline class is the reverse of the extract class
refactoring. And know that this is kind of a general situation in the
sense that it is often the case that the refactoring also has a
reverse refactoring that does exactly the
opposite. So basically, un-dos, in a sense,
the operation of the other refactoring. In this case, the motivation for the
refactoring is that during system evolution, we might end up with one or
more classes that do not do much. In this case what you want
to do is to take the class that is not doing that much and
move its features into another class. And then delete the original class.
So lets use an example similar to the one we've used for
the previous refactoring to illustrate how this works. Here we have in
this case, two classes, person and office. And the person class is
using the office class, but this latter class, the office class, only
contains a phone number. So it doesn't really do that much. What
we can do is therefore to fold the office class into the
person class, by simply moving its only field into the class. And so
the result will be this person class that also contains the information
about the office number, and overall a simpler design for the code.