Understanding changing dependencies
In Chapter 1, Getting to Grips with Test-Driven Development, we discussed refactoring the code we are writing as part of the Red-Green-Refactor TDD technique. This involved limiting the cleaning up of code as we write it. However, as we continue our journey with TDD, it is essential that we consider how our code will evolve through time and consider larger-scale code refactoring or rewrites.
Code refactoring is often used interchangeably with code redesigning, but they represent different levels of code modification. Code redesigning involves changing the functionality of a code base/service, while code refactoring involves changing the way the service delivers its existing functionality. In fact, if done correctly, code refactoring will be invisible to any internal and external users of the service functionality.
The purpose of code refactoring
Developers refactor their code to make it more efficient, maintainable, and extendable. There...