DEV Community

Discussion on: How it's like to refactor code, written by other developer?

Collapse
 
shubhamrai1993 profile image
shubhamrai1993

Personally I like refactoring as a great way of understanding someone else's code. Just keep adding comments wherever you struggled to understand. Usually useful to someone.

Collapse
 
kylegalbraith profile image
Kyle Galbraith

I agree with this for the most part, but I think it's important that the code you are refactoring has tests before you actually commit to refactoring. Another approach here, if the tests don't exist, is to write the tests yourself. This is another great way to learn some else's code.