Squeezing a Gallon Out of a Pint Pot

Another challenge I was given during my early working years, was to print graphs. Ok, not such a big challenge today, but back in the days when computers were all text based, this was something of a novelty.

With the advent of the dot matrix printer, came the possibility to print graphics. However, except for a few gimmicky programs and hobbyists, no one really bothered. Graphics required memory, lots of memory (at the time).

My task, was gather data from the database and use it to print stacked bar charts, not just one, but eight, per 14 inch wide page.

Today, it would be a relatively simple task of creating new empty bitmaps, drawing the graphs onto those bitmaps, and then printing them out. However, the computers at the time simply didn’t have enough memory to generate one bitmap, let alone eight. Admittedly, only four graphs had to be printed simultaneously (4 across, 2 down), but even so, this was beyond the capacity of the technology of the era. I could have used temporary files to store the bitmaps, but with disc access speeds at the time, this would have made the program very slow. Instead, I chose to calculate and print the graphs, slice by slice.

I locked myself away in my office for a couple of weeks and with pencils and a stack of graph paper, worked out how to do it. It should be noted at this stage that I had been given my own office. This was not a privilege, in fact, quite the opposite. It was mockingly referred to as “the goldfish bowl”, and for good reason. Formerly a kiosk, this 2m by 2m room was windowed on all four sides. This meant that the occupant could be observed at all times. My unconventional working style had landed me in this place. Apparently, thinking and doodling were not considered work. Instead, programmers were expected to mash the keyboard for eight hours a day until a program came out.

About a week or so in, I was asked by the managing director to show him what I had done, but not a single line of code had been written at this point. He was not best pleased. The following week, was a similar situation. Some experimental code had been written, but the program still had not been started. The MD stopped me as I was walking to the printer in order to collect such an experiment.
“There’s a pay rise in it, if you can finish that program by the end of the week.”, he said.
“Oh, well,”, I replied, “I guess I won’t be getting it then.”

However, the Wednesday of the following week saw a completed program. It was fast, printing graphs as fast as the printer could go. It was also bug free and never required fixing.

Epilogue

Some years later, after I had left that company, I found myself in the area and just popped in to say hello. Whilst chatting to the MD, I noticed the printer was printing graphs. My program, but there was something wrong. It was so slow, pausing for several seconds before printing each line.

“Is that my program?”, I asked, “Why is it so slow?”
“No, we had to rewrite it.”, he replied.
“Why?”
“We needed to change it from stacked barcharts to standard barcharts and no one could understand the code.”
“Just out of curiosity.”, I probed, “How long did it take?”
“About two months.”, he answered, with the sheepish smirk of a boy caught with his hand in the biscuit jar.
“So, why didn’t you just feed it zero values for the data series you didn’t want?”

A look of realisation dawned over his face, as he realised the implications of the suggestion.