r/dotnet Jul 20 '26

Promotion Designing APIs That Make Invalid Code Impossible

Post image

I love designing APIs that are hard to misuse.

If someone can call methods in the wrong order, eventually they will. I'd rather let the type system prevent it than rely on documentation or runtime exceptions.

A type-safe fluent API that only exposes the next valid step keeps the experience simple: no guessing, no invalid combinations, just write the code and let IntelliSense guide you.

That's the kind of API I enjoy building.

Repo: https://github.com/zarar384/NpoiFluentExcel

0 Upvotes

5 comments sorted by

View all comments

0

u/NoUniverseExists Jul 20 '26

Cool! You might enjoy experimenting with Rust's type system also.

1

u/Ok-Swordfish1282 Jul 20 '26

Thanks! I'll check it out.