Techniques to break dependencies

Now that we've seen some techniques to help us understand the code, our next step is to break dependencies. This will help us write further characterization tests. To do this, we will very carefully start modifying the code. All the while, we will try to stick to the following goals:

  • Make small changes that are very unlikely to break
  • Try to change the public interface as little as possible

Why these goals? Because we have a lack of tests, we have to be careful with the changes we make. Hence, small changes are better. We also need to be careful of changing the public interface because we have to go and fix all the other files and modules that use this class.

The Rope refactoring library

The Rope refactoring library ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.