Outside of niche areas, I think programmers can easily go at least 5 years without needing an upgrade. The average office worker can probably use recent hardware until it breaks. My 2016 Macbook would be fine for day-to-day work if the battery wasn't completely dead. My current laptop (M1) and desktop (3600) are both 2020 models and fine for most programming tasks.