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.
Next time you're making a change to your code, take some time to look at your code and ask the following questions.
- Is there any variables or methods that can be renamed to make the code clearer?
- Is there any parts of the code that can be moved into a new method?
- Is there any comments that can be removed or updated that no longer make sense?
- Can I improve the white-spacing or formatting of the code?
- 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.