BuySellAds interview question

How did you make the decision to factor certain code out of a component or function?