Home‎ > ‎

Refactoring Tips

  • One refactoring at a time
    Even if you can see the ultimate new design for the code, do one abstraction, interface, renaming, etc. at a time and test the program after each step

  • Moving code into a library? First Interface, then Abstractions, then Concrete classes
    Use Interfaces as stand-ins for any dependencies required by your concrete classes. EG: you need to pass around a session object that stores a user ID and permissions and other trivia, but the Session class itself has dependencies that weave everything into a bird's nest of code that you would have to migrate in one big lump. Decouple those classes with Interfaces that stand-in for their dependencies, refactor to them, then migrate the Interfaces to the library and refactor, then the abstractions, and finally your concrete classes

Comments