#DefensiveProgramming

2025-06-15

A large chunk of client JS code is just this over and over and over again. In case *I* removed a necessary element when *I* wasn't watching. 🤦‍♂️
```
const x = document.getElementById("X");
if (!x) {
console.error("X element not found.");
   return;
}
//later
alert("Check console.");
```
#technology #programming #JavaScript #defensiveProgramming

2024-10-22

Weekly Dev Chat 2024-10-22: Winterizing Your Codebase: Preparing for Stormy Weather

weeklydevchat.com/2024-10-22-w

Everyone and anyone is welcome to join as long as you are kind, supportive, and respectful of others.

#weeklydevchat #resilientsoftware #defensiveprogramming

2024-07-23

Write More Robust Code: Sub-ranges in Object Pascal

Want to write better, bug-free Object Pascal code? Dive into defensive programming with sub-range types to make your code stronger and less prone to errors. We'll break down how to set up sub-ranges, explain why they're awesome, and give you real-world examples to improve your code.

References -
wiki.freepascal.org/subrange_t

youtu.be/jTnhu6NzNLw

#objectpascal #defensiveprogramming #subranges #programming

Peter Drake HAS MOVEDpeterdrake@qoto.org
2023-08-13

I set up my Python code to make sure that (a) we're in a clean git state and (b) we haven't already run an experiment with the same ID number.

This has saved my bacon more than once, preventing either wasting days of computation or overwriting hard-won data.

#python #DefensiveProgramming #git

2023-07-30

Defensive driving on American highways is when you assume that everyone wizzing past you at 30 above posted is out to do you in, so you use more-than-warranted caution.

Likewise, in #IT, #DefensiveProgramming is when you assume that every piece code—functions your team wrote, libraries and frameworks that were foisted upon you, all of them—are out to get you.

And like defensive driving, defensive programming turns a freeing, joyous activity, namely programming, into a paranoid schizophrenic #disorder.

2023-03-02

* Assertion at /.../src/mono/mono/metadata/....c:..., condition `0' not met: It probably would have worked, @lambdageek, except you added an assert to guarantee that it won't.

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst