How do people refactor code?

One of the pieces of advice that gets trotted out here fairly often is: Don’t refactor…

…yet.

While you are still learning the fundamentals, just keep chugging through the algorithms.

Each time you solve one, celebrate the win and then move on.

Once you have built some more projects and picked up a few new tricks, you may want to go back and refactor the old algorithms then. Personally, I haven’t bothered with that methodically, but I do hang out here enough to see algorithm questions pop up and when I have a crack at them again just to help others, I find myself naturally reaching for different methods than the ones I used originally.

5 mins after you completed the challenge is the worst time to refactor it, unless you happened to pick up a whole new, paradigm-shifting method in those 5 mins!