Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is defensive programming defending against?

0
Posted

What is defensive programming defending against?

0

There are a number of different things covered by this phrase. In the first instance, a defensive programmer is protecting themselves [2] against their own mistakes. All programmers are optimists [3] and so each one of use tends to ignore the reality that every line of code we write has a probability of being wrong. The probability may be lower for some of us than for others (we all think that) but it is never zero, and the consequence is that the bigger the program is the more certain it is to contain at least some incorrect code. Most programs are not written by a single programmer, and so defensive programming also means defending your code against other people’s misuse of it. In an ideal world it should be obvious to others how to use the code I’ve written and this reduces the need for other forms of defence. However even where other people do not find the code obvious to use we should try to make it easy for them to understand what they have done wrong and how to get it right. Thi

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123