This topic will always remain one of my favourite by the title itself. Refactoring simply means to clean and refine your code so that it can provide better look and more managageable code. Defining it in a more academic way we can say it as the process to improve code to make it more clear and organized by implementing best coding practices so that code can be easily managed in long span of time.
Refactoring is although a process, but a good code means good refactoring cycles. Refactoring will depend on your logically thinking capacity and how seriously you take this task. Overall, great refactoring will result in fewer lines of organized code.
I don't want to go depth into what refactoring as there are already great materials online. I will explain why I personally think refactoring is so important to any developer, beginner or expert.
Refactoring improves your code and your coding technique
Refactoring actually help you to stop at a point and anzlyze your own code. There may be some task which is completed in 3-4 lines then you can use some inbuilt library function to complete the task in single line. This will improve the quality as the next code analyzer/developer can save his/her time. As we are viewing our code, so that we can improve, we are pushing our brain to think to next level to improve our work, it ends up making us better programmer as next time when we code we may be able to do it directly at the time of initial coding.
This concept may be cleard by imaginging your messesd up room,which you start to arrange. Suprisingly, you find your missing childhood photo. Oh hell yes, refactoring will help you to find the hidden bugs that might have slipped while you were stacking your code rapadily. So, why not to travel back to make some fixes in your code ?
During our code process we sometimes end up doing unnecessary or tasks that are consuming more of the hardware resources. Refactoring will help to change these lines of code to improve performance of your software.
Refactoring means brining common functinality as a library module. We can use this library when we are doing similar project which will ultimately save our time. So, why not stop for a moment and think of productivity that can be attained in long run.
These were some points that I thought worth sharing. I will add more points when I also come to know something new.