Dorian Gray

It had been a long meeting, and Bert was exhausted. Now, normally when a story on TDWTF starts that way, we go on to tell you about a hapless developer trapped in management hell, but this time, we're flipping the script on you: Bert was the Business Analyst on a project to enhance some self-check software for a number of supermarket chains. Ernie, the Software Engineer, was one of those braindead devs who needs everything spelled out before he'll write so much as a line of code, and Bert was much more comfortable with the looser specs in Agile projects.

Since the fourth Requirements Clarification Meeting was dragging on into hour two, Bert was getting a little snippy. So when Ernie asked for clarification on exactly how long a given printout might be, in millimetres, Bert couldn't help himself: he cracked. "Well, potentially infinite, I guess!"

The code Ernie delivered:


 public override SizeF PaperSizeInMM
 {
 get { return new SizeF(110F, float.MaxValue); }
 }
 
 

To put this in perspective: float.MaxValue here is 3.4x10^38 millimetres. This equates to about 11,018,635,432 gigaparsecs. A single parsec is 13 trillion kilometres; a gigaparsec is 1 billion of those. The observable universe is a sphere with a diameter of about 29 gigaparsecs. This author's spellcheck doesn't even recognize gigaparsec as a word!

But it wasn't just silly: it was bug-inducingly silly. On some versions of Windows, this would cause GDI+ to throw up its proverbial hands and emit a "Generic Error", crashing the self-check machine.

Next time, Bert would just rattle off some large number and call it a day...

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!