Hacker News new | ask | show | jobs
by nicbou 1458 days ago
This is something I enforced in a big rewrite at a previous company.

People would take a full API response, and pass bits of it around with mutations. Understanding what the object looked like 5 functions deep was really hard. If the API changed... Oh boy.

I found many bugs just tracing the code like this. It made me a big proponent of strong typing, or at least strong type hinting.

1 comments

Same experience here.

It even has additional advantages, such as generating open api files automatically from the types and validating payloads between microservices.

Pydantic and Typeguard are too very useful libraries in this context.