5 Simple Questions To Help You Start Refactoring

Refactoring can seem like a big scary word, but it's an essential part of becoming a good developer. What many developers don't know is refactoring doesn't require massive, sweeping changes. Even small changes can help our codebase become better. It's important that we start somewhere and what better time than now.

Refactor Checklist

Next time you're making a change to your code, take some time to look at your code and ask the following questions.

  1. Is there any variables or methods that can be renamed to make the code clearer?
  2. Is there any parts of the code that can be moved into a new method?
  3. Is there any comments that can be removed or updated that no longer make sense?
  4. Can I improve the white-spacing or formatting of the code?
  5. Is there any dead code I can remove?

If you can act on even one of these questions, your code will become better. Over time these changes add up. Before you know it, these changes will add up. You might become more bold to make bigger changes when you see how easy it is. Remember, only you can prevent code rot.