We may earn an affiliate commission when you visit our partners.

Defensive Coding

Save
May 11, 2024 3 minute read

Defensive Coding, alternatively known as Defensive Programming, is a concept in software development where the programmer anticipates potential threats such as malicious inputs, invalid data, or resource shortages, and takes steps to mitigate the risks associated with these threats. The main goal of Defensive Coding is to ensure that the developed software is robust, reliable, and secure, even when it encounters unexpected or exceptional conditions.

How Defensive Coding Works

The key principle of Defensive Coding is to assume that any input or condition can be invalid or malicious. This approach leads software developers to employ various techniques to validate and sanitize inputs, handle errors gracefully, and implement security measures to prevent unauthorized access or data breaches.

Defensive Coding techniques include:

Share

Help others find this page about Defensive Coding: by sharing it with your friends and followers:

Reading list

We've selected 12 books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Defensive Coding.
Provides in-depth coverage of defensive programming techniques in Java, including secure coding and threat modeling.
Provides a comprehensive guide to secure coding practices, including defensive coding techniques.
Focuses on defensive programming techniques in object-oriented programming, including design patterns and testing.
Provides a comprehensive guide to secure coding in C and C++, including defensive coding techniques.
Covers advanced debugging and reverse engineering techniques. It provides a good understanding of defensive coding techniques.
Provides a comprehensive guide to secure coding in JavaScript, including defensive coding techniques.
Provides a collection of best practices and design patterns for writing effective Java code, including defensive coding techniques.
Provides a classic discussion of software development challenges, including the need for defensive coding.
Table of Contents
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser