If there's one thing worse in code than magic numbers, it's magic strings. Sean inherited an antique Visual C++ application, and the previous developers were very careful to make sure every string was a named constant.
const char $$B = "$$B"; const char $$E = "$$E"; const char $$L = "$$L"; const char $$IN = "$$IN"; const char $$OUT = "$$OUT"; const char $CODE = "$CODE"; const char $ENDE = "$ENDE";
There, isn't that much clearer? You don't have to worry what a cryptic string like
"$$B" means in the program, you can now use a helpful constant,
Now, if these strings were used in the output somehow, like columns is a CSV file or maybe some sort of Domain Specific Language, this might make sense. That doesn't appear to be the case, however, and Sean is actually unclear precisely what these are actually used for, even if they do get referenced in code a fair bit.
This post originally appeared on The Daily WTF.