Amit checked his latest code in and turned to more interesting work. It didn't take much to be more interesting than writing a CSV parser. That was kid's stuff, really. With the low-hanging fruit out of the way, Amit could focus on the more mission critical aspects that were on tight deadlines. He had designed the module with a little extra polish; it was generic and should be easy to modify in the future. That was a smart decision, as a few days later the requirements changed. The application also needed to be able to handle pipe (|) separated values data. Since Amit was tied up on more important work, his manager stopped by to ask a few questions.
"How difficult do you think this would be?" John asked.
"It's really easy. There's a constant, DATA_SEPARATOR, someone could turn that into a variable expression. From there, it's just a matter of making the module configurable," Amit explained.
"So, you think Tony could handle it?"
A first year CS student should be able to make the change in a few minutes, and then spend maybe a few hours running some test data through to make sure it behaved properly and the mapping file for the conversion worked. "He should be able to," Amit said, diplomatically.
There was a vast field between "incompetent" and "incompetent enough to get fired", and Tony frolicked in that field among the Lilies of Wasted Effort and the Butterflies of Uselessness. He was the sort of person that could only survive in a large company where his dead-weight was barely noticable among the bueraucratic morass. Amit's statement was literally true: Tony, a senior developer, should have been able to make these changes. Could he, on the other hand?
Minutes later, Amit's inbox dinged. Tony's email complained, "It's not working. :("
Amit replied with simple instructions:
Find the line that reads#define DATA_SEPARATOR ','
and change it to#define DATA_SEPARATOR '|'
. We can worry about configuration later, but that should let you get started on testing your column mappings.
A few hours later, Tony swept into Amit's office on the black wings of the Angel of Vexation. "It's still not working," he whinged. "Can you take a look?"
Amit took a look. The obvious problem was that, instead of changing the DATA_SEPARATOR definition, Tony had merely added a second one, labeled DATA_SEPARATOR_TWO. "It was giving me a compiler warning," Tony explained.
Amit took the path of least resistance and fixed the declarations, and then gave it a run to see what happened. The application failed on parsing and complained, "Content in column 0 too large; check input data and mapping file."
"Well," Amit asked Tony, "did you check the input and mapping files?"
"No," Tony said. "But they're definitely good, I just converted one of our test CSVs to PSV."
"Well, maybe the conversion tool screwed up," Amit suggested. "What did you use?"
"Conversion tool?"
Amit opened the PSV file Tony had "converted", and saw that the file was chock full of commas, not pipes. Tony had simply changed the file extension. "That doesn't work?" Tony asked. "Then why do they let you change the file extension? What's the point of that? They shouldn't even put a feature in if it doesn't work."
"Do you think," Amit grumbled, "that if we changed the extension to .mp3, it would play on your iPod?"
"Oh, I don't have an iPod. But my Zen could definitely play it. No DRM, you know."