The first thing I learned about programming was your best asset was your ignorance. Admit you don’t know and you’ll learn or get help. The obvious corollary is you can’t assume anything. Ever. If you don’t know the facts of what is or what will be (e.g., what people might input), you’ll program for all the possibilities.
I’m writing this post because I’ve been hammered by bad programming assumptions for four straight days. No Internet on boot up, but more than half-a-dozen programs didn’t know it. Somehow, they thought I was connected when I wasn’t. (The solution, which I’m still working on, has to do with renewing router lease time.)
My first exposure to stupid programmer assumptions was nearly fifty years ago when I found out dividing by zero would crash the machine. Programmers were responsible for checking values input to arithmetic operations. Some of us did. The better solution came when the computers added hardware to check for division by zero.
Too many things can happen in software to solve in hardware. I mentioned not knowing if there is or isn’t an Internet connection. Almost all programs assume there is one. Yet, to verify (are you listening all you greedy updaters?) takes only milliseconds. Nobody bothers. And I can tell you why.
Most dumb programmer assumptions result from their atypical user environments. Many programmers have faster machines, better Internet connections, bigger displays, etc., than we ordinary users. Even small-time programmers can make bad assumptions. For example, when they test Internet code on their computer, instead of through the Internet, i.e., as other people will use it.
Too many websites only work with Microsoft’s Internet Explorer, despite having less than a quarter of the market. Too many programmers write code for the size and resolution of their display, causing problems for anyone differently equipped. Almost all programmers pop messages on and off the screen too fast—with no way to read after the fact. Nearly every single Windows programmer assumes the Task Bar is at the bottom of the screen. This hides part of their window if it’s elsewhere (top, left, or right—or of varying size).
In programming, there are no good assumptions, except that something is likely to go wrong. But don’t assume you’ll know it. Finding out what went wrong is hard, but only the beginning of the really hard work.