News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

A general note on bugs and placing blame

Started by NoCforMe, April 23, 2024, 10:57:59 AM

Previous topic - Next topic

NoCforMe

This is a general-interest posting using myself as a (negative) example of how not to deal with bugs and unexpected program behavior.

Case in point is my PicView project, described in a long thread in the Windows API forum. An issue arose with my use of a progress bar which I was trying to make work in "marquee" mode, where the control animates endlessly instead of indicating finite progress. Well, long story short, I just couldn't get it to work: the control would appear when un-hidden, but just refused to do the "marquee" thing.

Another user here found that displaying a picture (the purpose of the program after all) caused the progress bar to work properly. After playing around with it a bit, I determined that there was some mysterious interaction between GDI+, which I was using to display images (because it knows how to open all kinds of picture files, unlike plain GDI which only knows about BMP files) and the progress bar. The more I experimented, the more I was sure of it. Something was happening at some deep underlying level that was preventing my progress bar from "marquee-ing". And the culprit seemed to be GDI+.

I was wrong. There was no such interaction. It was all because of a stupid mistake on my part (specifically, mis-handling the WM_PAINT message in another control's window proc which was screwing up the message queue).

So the moral of the story is, if you're facing a frustrating problem that you can't seem to fix, even with the help of other people making suggestions, resist the temptation to throw up your hands and say "it's Microsoft's fault!" (or any other OS, application, device driver, etc.). The chances that there's some kind of mysterious, unknown and deep bug in the OS that's causing your problem is fairly slim. Sure, Windows has bugs, some well-known, some not so well-known. But overall, it's a piece of software that you can bet has been hammered on relentlessly before being released, unlike your piece of code that only you are working on.

It's like a corollary to Hanlon's Razor ("never attribute to malice that which can be adequately explained by neglect, ignorance or incompetence"). Don't jump to the conclusion that your error is caused by (the OS/a commercial application/etc.) when the problem is more likely explained by you screwing up.
Assembly language programming should be fun. That's why I do it.