As long as possible.
0. Software developer
1. Current laptop is HP EliteBook 835 G7 (16 GB/256 GB SSD).
2. I bought the current laptop secondhand for few hundred a year ago. I expect to get 5+ years out of this one.
Previous laptop was MacBook Pro (15", mid 2015) that I would probably still be using, but I need to change it's keyboard and haven't bothered to do that yet. That lasted for 8 years on my use.