Article 7XHB CodeSOD: Universal Printout

CodeSOD: Universal Printout

by
Jane Bailey
from The Daily WTF on (#7XHB)

Dorian_Gray.jpg

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...

inedo50.png[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated! TheDailyWtf?d=yIl2AUoC8zAgcPdF2v35LY
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments