DEV Community

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

Collapse
 
samsha1 profile image
samsha1

Hey, @rhymes thanks. Now, I am clear that tests are key things to start with as mentioned by many.

Collapse
 
rhymes profile image
rhymes • Edited

I forgot to mention this: I would begin with functional/integration tests first, unit tests later or at least I would de-prioritize them.

If there are no tests you should start testing for features, not necessarily for small units.

Play with the actual app, understand how it works, maybe sprinkle it with some log.debug statements if you're unsure, then write a test where you "excercise" a behavior and expect an output. If you do this a few times you setup a battery of tests tied to specific functionalities.

After that you can refactor with a little safety net in the form of those tests that can also act as a documentation for posterity.