Monday, June 27, 2022

Refactoring Playground

Refactoring is one of the most essential activities developers must do to continuously improve the code they are working on. You can refactor on various levels: changing the implementation of methods, modifying how classes talk to each other, and redesigning the architecture.  

Today I want to share with you the repository I'm using to practice and teach others how to refactor the code.


You need the playground

I spent a lot of time looking for a code base I could use during my training. The code base with a lot of coding and architectural issues, but on the other hand, well covered with tests. 

Finally, I decided to create my own. You can find it here: legacy code task manager.


What you need to know?

  • I did my best to write the code in the worst possible way.
  • Most tests are not readable (intentionally), but they cover the functionality well, so you are safe with doing your refactorings.
  • The code coverage is high. Just check stats on SonarCloud.
  • Even though static analysis is satisfied with the code, it does not mean everything is good. I just used a few tricks to cheat the tools.
  • You can run the code but remember it is not a fully functional application. There's just enough code to practice refactorings and show problems.


What can you do with it? 

Feel free to:

  • practice small refactorings, refactoring to patterns, or introducing a new architecture.
  • use for your training.
  • add some code worth refactoring on your own. 


How to start?

Most tests cover functionality well but I recommend starting with Controllers and beginning your journey from there. 


Conclusion

If you are looking for a repository that can serve as a playground for refactoring, look no more, you just found it: legacy code task manager.



 

No comments:

Post a Comment