Replace Magic Number With Symbolic Constant

See MartinFowler's RefactoringImprovingTheDesignOfExistingCode, page 204: http://www.refactoring.com/catalog/replaceMagicNumberWithSymbolicConstant.html

See MagicNumber for more discussion and examples.


A QA representative was assigned to ensure that my boss's code met quality standards. Not being a programmer herself, she asked another programmer to look over the code. That programmer told her "It's pretty good, but it could use some more symbolic constants."

So the QA person went to my boss and asked "Can you add more 'symbolic constants' to your code?" With a perfectly straight face, my boss responded "Symbolic constants are expensive, so I don't want to add too many." This answer seemed to satisfy her.

A few days later, all the project members met with upper management to discuss project status. When it was her turn to speak, the QA rep said "I think it is vital that we increase the development budget, so that the software developers can obtain more symbolic constants."

My boss laughed so hard he fell out of his chair. The manager of QA fumed. The company president maintained his composure, but later admitted it was one of the funniest things he had ever seen.

The QA person quit a couple of weeks later. My boss was admonished to stop torturing QA personnel.

The QA person probably made the right decision to leave, albeit for the wrong reasons. Any rep assigned to QA a program had better know at least what a symbolic constant is. Alas, the rep probably left because she felt outcast from the group. She should have left because she knew she was wholesale unqualified for the position.


"Stop torturing the QA personnel?!?" But that's what I thought we were supposed to be doing! ;->


CategoryStory


EditText of this page (last edited January 28, 2009) or FindPage with title or text search