Refactoring

Refactoring is the process of cleaning up code or changing a design using a sequence of very small steps. No new functionality is added or removed during the refactoring process. The aim of refactoring is to make the code better by eliminating some code smell. There are many types of refactoring, from the extremely simple going up to much more complex refactorings. Let us apply some of these to the code above.

The Rename Variable and Rename Method refactorings

These two are probably the two simplest refactorings. The names are self explanatory—the refactoring is to rename a variable or a method. Although simple, they are very important because poor variable and method names are very common code smells.

The following are the steps to ...

Get Test-Driven Python Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.