As a developer, we want to maintain our code well. This is to ensure that ourselves and others can understand the code later on. We should have a standard in writing a code, and one of the most basic collections of principles that can help us is Clean Code. When your code is clean, it becomes better, understandable and a lot more maintainable. The best method to achieve this is refactoring.
The refactoring method is a recommended approach to commit after each and every step.
- Choose one single refactoring step
- Execute the selected step
- Verify the code still works
- Commit current state and go back.
This method is a good as it gives you safety line. That’s means when something bad happens, you can easily revert it back to when it happened. You can also stop it at any point in time without losing progress. The linked article below shares more detail on this method.