The stupid, it burns! - Journal of Omnifarious
Jan. 25th, 2006
07:56 pm - The stupid, it burns!
I'm dealing with a huge body of code. I'm estimating that it's about 5-10 times larger than it needs to be to get the task at hand done. Seriously.
For example, there's a lot of XML parsing going on. A whole pile of it. For each and every element or attribute name, there are two constants and one #define. The constants are painstakingly initialized one at a time by a big block of code. The constants and #define names are each at least 4 times longer than the string they stand in for. These names are religiously used throughout the rest of the code.
Small example, lest you disbelieve me (keep in mind that this code is actually scattered in several different places and not conveniently stuck together):
#define SYSTEM_VSAM_STR_ELEM_VSAM_REQUEST_FIELDS "RequestFields" XMLCh* System_VsamLayerUtils::DOM_SYSTEM_VSAM_STR_ELEM_VSAM_REQUEST_FIELDS = NULL; DOM_SYSTEM_VSAM_STR_ELEM_VSAM_REQUEST_FIELDS = XMLString::transcode(SYSTEM_VSAM_STR_ELEM_VSAM_REQUEST_FIELDS); tcDeleteTranscode(DOM_SYSTEM_VSAM_STR_ELEM_VSAM_REQUEST_FIELDS);
And the worst thing is, all the XML parsing code is using the LONG_NAMES instead of simple strings, and I'm trying to figure out what various pieces of XML cause the program to do. This means I have to be flipping all around the program hunting down the definitions of these stupid constants.
P.S. Sorry about the late edits and overly wide lines. I was pressed for time as the coffee shop I was in was closing. I should've made the entry private or something then made it public later. Though, some of the styles are worse than others if people make their entries too wide.