Click here to Skip to main content
15,947,785 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
How to start code refactoring? How to do it correctly and is it worth doing code analysis before refactoring?

What I have tried:

I tried to refactor the code, but I don't understand how to start
Richard MacCutchan 4-Jan-23 6:57am    
You first need to decide what you want the end result to be. Then look at your code and try to figure out the areas that need work. This is not something that anyone can do for you, unless they are very familiar with the actual code.
Member 15627495 4-Jan-23 7:13am    
refactoring needs the knowledges about 'execution environment' and 'languages' involved in the software or website.

there are few 'signs' for a code needing 'refactoring'
- repeating schemes ( redundant codes or code structure )
- vars crowd ( are all the vars useful ? )
- accurate use of the 'languages' and 'env. features'
- logical ( can you write a shortest code instead of the current code/structure ? )

( deep debating here, its requiring 'skills' a 'junior coder' won't work like a 'senior coder' )
[no name] 4-Jan-23 9:28am    
Refactoring comes with experience; being able to recognize "good" patterns and bad patterns (in code), and when it's worth changing.
Dave Kreskowiak 4-Jan-23 10:25am    
How do you start? You have to be able to spot how your could would be improved. That only comes with experience. Nobody can tell you "start here and do this" because there is no one method for improving code. What you do to improve code depends entirely on the code that has been written, whats its purpose is, the algorithms being used, identifying what the problems with the code are, and the desired end goals of the improvements are.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900