
144 ◾ Software Engineering: The Current Practice
it is not a surprise that they are the same for sparse and dense matrices. ere is sig-
nificant overlap between the old and new functionality; consequently, the situation
is suitable for the addition of the new functionality through polymorphism, but
that polymorphism has to be introduced into the program through prefactoring.
In the first step of the prefactoring, the programmers rename class Matrix to
class DenseMatrix. e goal is to create several different classes that deal with
matrices; therefore, each of them needs a more descriptive name. After renam-
ing, the change is done in two steps: ...