DEV Community

Discussion on: Where to start refactoring.

Collapse
 
rhymes profile image
rhymes • Edited
  • Start small, don't try to do everything at once
  • Get help from tools that analyze your source code
  • Throw an eye on the online catalog of refactorings
  • Inspect the code of some open source projects on Github in the language of your app
  • Dependency injection is often better than complex inheritance hierarchies
  • Keep your functions/methods as side effect free as possible
  • Make it easy to other people who haven't seen your code base to pick it up in the future
  • Run the tests at step of your refactorings
  • Have fun
Collapse
 
drbragg profile image
Drew Bragg

Make it easy to other people who haven't seen your code base to pick it up in the future

This is a big one for me. I have been the only dev on this project since its inception but we're looking to bring on another dev soon and I'm kinda embarrassed about some of the code and how its organized (or lack thereof). I understand that my newer projects are a lot better cleaner and that this was a massive undertaking for someone of my skill level at the time but I'm still not comfortable with showing the code to someone else.

Have fun

Always!

Thanks for the tips, good to know I'm on the right path.

Collapse
 
rhymes profile image
rhymes

I'm still not comfortable with showing the code to someone else.

Ah ah I understand. But see it this way: you may not have a choice soon. And with the right person and some pair programming to teach them the code base you might both learn something

Thread Thread
 
drbragg profile image
Drew Bragg

That's the hope!