0% found this document useful (0 votes)
7 views6 pages

My Defensive Programming

The document discusses defensive programming techniques including input validation, error handling, fail-safe mechanisms, and secure coding practices. It recommends sanitizing inputs, managing exceptions gracefully, implementing timeouts and retries, and using authentication and authorization.

Uploaded by

onlinebhai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views6 pages

My Defensive Programming

The document discusses defensive programming techniques including input validation, error handling, fail-safe mechanisms, and secure coding practices. It recommends sanitizing inputs, managing exceptions gracefully, implementing timeouts and retries, and using authentication and authorization.

Uploaded by

onlinebhai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Defensive

programming
How to make code fault tolerant?

Pavle Davitkovic
Input validation
User inputs = valid inputs

Sanitize inputs

Input formatting

Built-in validation*

Server-side validation

*Fluent validation as alternative

Pavle Davitkovic
Error handling
Manage exceptions and errors gracefully

Resource cleanup

Retry mechanism*

Exception handling

Custom error messages

*Polly - resilience .NET library

Pavle Davitkovic
Fail-safe
mechanism
Fail in a safe and predictable manner

Timeouts & retries

Fallback mechanism

Controlled degradation*

*Polly fits here also

Pavle Davitkovic
Secure coding
practices
Secure code = less headaches

AuthN & AuthZ*

Secure configuration

Parameterized queries

*AuthN - Authentication ; AuthZ - Authorization

Pavle Davitkovic
Want to learn more?

FOLLOW ME

Find this useful?


REPOST

You might also like