Carefully refactoring a piece of globally used code?

So if you have to alter a piece of code which is used globally how do you change it?

Well there are a couple of different approaches.

One way it to “rip the bandaid off” - remove a large body of code you want to replace and get the whole team to return an application back to being functional.

Another approach is to create new code and then replace the usage of the old code, incrementally bit by bit and then at the end of it delete the old code when the all the code that depended on it has changed.

Pros and Cons of each approach:

  • Doing things incrementally gives the opportunity for the coder to check each part of the system as it changed over to the new code.

    • A good example of this might be changing button styles that are being used in an application.

  • Doing things with the rip the bandaid approach and using the whole team to fix the resulting breakages can be expensive in terms of using the whole team - but sometimes it’s be the best way to achieve large changes at a time.

    • We did this for our product development when we were making a major change in how we structured our CSS rules.