Both are a matter of net cost and convenience. It is generally much quicker to replace a door or window for the technician than to repair it, but he won’t paint afterwards. Furthermore, the cost of replacing exceeds repair significantly. If timeliness is an issue- replace, if finances are paramount- repair. The individual parts needing repairs on a window or door usually do not exceed $50 (e.g. PVC door frame) and can be as little as $12 (e.g. PVC brick molding). Many repairs to wood windows are neither hard nor expensive though most new generation carpenters don’t have a clue on where to get the parts. Doors are more problematic. Since the likelihood that the door frame needs replacement is high, replacement of the frame is seldom suggested unless your existing door is very nice and a new unit with comparable door too expensive.