If I’ve written a piece of code which is maybe a bit simplistic but I understand how every little bit works and if something goes wrong I can easily identify and correct the problem, why should I use a tool like ReSharper to turn my code into something I don’t understand?
Surely if you can’t write the complicated code yourself, using a code refactoring tool is just going to cause issues because you won’t be able to understand the new code when something goes wrong, and if you can write the refactored code manually why do you need the tool?
Or is there something I’m missing?
Thanks
I have never used a refactoring tool, but I imagine you could learn from the way it re-factors the code for you. However, you NEED to be able to sense when your code needs refactoring and know how to carry out the re-factoring on your own, or you will never live up to your potential as a programmer. It seems relying on a refactoring tool deprives you of picking up a sense of when things need refactoring. Definitely learn to refactor you own code.
[1] You will arrive at a cleaner solution that is easier for you and others to read[2] Reducing code repetition will likely reduce bugs, or make them easier to find and fix only once rather than multiple times throughout the code.[3] Once you have re-factored enough code, it will influence your coding habits andstyle so you more often code clean the first time, implying less refactoring.
Best motivation to refactor your code: It is no fun working with some one else’s sloppy code ( unless you get to gut it quickly in front of them. That’s always fun. )
If this re-factoring tool is some requirement for your job or class, you must learn it. Remember to test small. You may want to create a version of a small program when you think it needs re-factoring, and then in another version, do the re-factoring manually. Then feed the old version to the re-factoring software and compare your results.
Good luck! 🙂