Refactoring

Refactoring consists of improving the internal structure of an existing program’s source code, while preserving its external behaviour. 



 Refactoring does “not” mean: 
 - rewriting code 
- fixing bugs 
- improve observable aspects of software such as its interface


 Refactoring Benefits :

- Clean Code 
- No Duplication 
- No Technical Failures 
- Easy code maintenance 
- Easier to Manage and many more .... 


 When to Refactor Code: 

 - Sometimes , due to less time frame refactoring is not considered or given importance. In this case, after code accumulation, lots of Technical failures persists.In this case you can refactor your code. 
- During code reviews. 
- Passive refactoring will be fine too (during bug fixing, during development etc...,) 
- Most of the cases, detecting code smells and writing cleaner code will never account for a specific time for refactoring. 


 Some Refactoring Techniques:  
 - SOLID 
 - KISS(Keep It Simple, Stupid) 
 - DRY 
 - YAGNI 
 - Red Green Refactoring

Comments