logoalt Hacker News

Ekaros • today at 9:45 AM • 0 replies • view on HN

Defensive coding often is added because shit happens. So you need to take in account lot of scenarios you did not even consider at first.

My latest example is verifying JWT token. Works fine. Then just for some testing run with old token... Not verifying against any key I stored... Keys are pulled at start... And the service which sings JWTs might change them... Well now I needed to add logic to repull keys.

For long lived projects this sort of stuff happens over and over again. And thus more of these edge cases are added. And they are actually needed to solve some edge scenario. Even if that edge scenario can be very rare.