Understanding the rationale behind a rule when trying to circumvent it
devblogs.microsoft.com
devblogs.microsoft.com
For anyone not familiar with the term, Chesterton's Fence is the idea that you should understand why a rule exists before trying to remove it or work around it: https://fs.blog/chestertons-fence/
Here the issue is not that the rule was removed, but that the code followed the wording while missing the reason the rule existed.
1. I want to remove a rule
2. Understand why that rule is in place before proceeding
This article deals with the second part, but not the first. So it is only about about half of Chesterton's fence at best.
In these examples, a rule (avoid blocking calls) is in place to guide the programmer to a performant system. Programmers apparently thought that if they found a way to avoid directly blocking calls, but managed to indirectly block, they had still obeyed the rule. And strictly by the most narrow reading of the rule they had obeyed it. But they had defeated the purpose of the rule.
So definitely Chesterton's Fence adjacent, but not Chesterton's Fence itself.
I remember back in the 80s when I was a young kid (maybe 8 or 9) and I'd just started learning Z80 machine code. The manual for the computer had a strongly worded "do not use the alternate register set" (probably bolded and all caps), and sure enough the one time I tried, the computer crashed. I decided that it must be dangerous, and never tried that again.
It was only years later when I discovered that the OS firmware used the alternate registers in the interrupt routines, and assumed that they were always set a certain way (in particular, BC was used to ensure ROM was visible not RAM before jumping into it, and on return RAM was paged back based on the existing contents of that register). So, if the warning had said "don't use the alternate register set unless you disable interrupts and save/restore the registers before re-enabling them", it'd have indicated what the problem was and why. Additionally, I think somewhere else there was a dire warning about "disabling interrupts for too long" with no indication what was too long or what problems it might cause. In reality the only thing it affected was the built in system clock which was only used by BASIC and the sound firmware, so for almost everything you might want to do it didn't matter in the slightest. (Actually, there was a slight caveat with the hardware that you actually did need to acknowledge the vertical sync interrupt within a certain time frame or it would fire at the wrong time on the next frame, but even if you did that, it would correct itself by the second frame, so again was entirely unimportant, especially if you never planned to return to BASIC).
As well as not explaining the why, which helps understanding of the system generally, a list of prohibitions makes experimenting with the computer seem scary. One of the best things about old 8-bit home computers was that there was very little you could accidentally do in software that'd actually cause any lasting damage, unless you were deliberately doing stuff like toggling relays as fast as possible or fiddling with the monitor sync signals, sending excessively out-of-range timings and then left the monitor for a long time.
First day, a monkey climbs the scale, gets the banana and is happy.
Second day, they start spraying whomever gets on the scale. Monkeys hate this. They learn not to climb.
Third day, they take a monkey out and replace with another. The new monkey sees a banana up there and tries climbing the scale. He literally gets beaten out by the others, like "seems like you're new here".
Days 4-12, they've replaced one monkey per day, so that no monkey was here when it was possible to get the banana. None of them have ever been sprayed either. Still, they enforce the rule not to climb up there.
I am putting this example because in our society as well, there are many rules that are enforced without anyone questioning the "why". Yet the "why" is often more important to know than the rule itself.
Designers know this dichotomy between the "why" and the "how". Most people don't.
The lessons I'd take away from the experiment would be 1) be sure to tell people why the rules exist, but also 2) follow the rules even if there's no apparent reason for them, otherwise you might get smacked down by some unimaginably powerful entity you're barely even aware of.
Another example of why technical writing is difficult, I think.
I always liked that mindset, and it helped teach me the important lesson that sometimes being the person who asks very basic questions because I don't understand things can make me valuable to the teams I work on. There are certainly times when the answer makes me go "oh, duh!", and I feel a little sheepish, but the feeling doesn't last very long, and no one has ever held it against me, whereas the times when it leads somewhere interesting and potentially to better documentation for people coming after me are far more frequent and memorable to everyone involved.
This isn't to say that the burden should fall on the ones who are reading the documentation rather than writing it, but to encourage people who are in the position of being frustrated and confused to take advantage of those moments, because they can make you very valuable to your team in addition to helping you learn. If you're on a team that operates in good faith, the burden for documenting things well can be shared, and in the long run it will matter less who's job it is to keep it updated and more about whether everyone is contributing however they can to maintain the quality (and if you're on a team that operates in bad faith, you have my permission to keep quiet and do whatever you can to get through that experience, not that you need it from me!)
There's a third party tool for collecting and examining such traces easier called UIforETW
> The documentation should open with something like this:
>> The callback function must perform its work quickly without blocking. If you need to do complex work or synchronize with other threads or processes, do the work asynchronously, such as by using System Worker Threads.
A change was made, but not the change that Raymond thinks would explain why the list is there anyway.