CodeSOD: Like a Tree, and…

Duncan B was contracting with a company, and the contract had, up to this point, gone extremely well. The last task Duncan needed to spec out was incorporating employee leave/absences into the monthly timesheets.

"Hey, can I get some test data?" he asked the payroll system administrators.

"Sure," they said. "No problem."

{ "client": "QUX", "comp": "FOO1", "employee": "000666", "employeename": { "empname": "GOLDFISH, Bob MR", "style": "bold" }, "groupname": "manager GOLDFISH, Bob MR", "drillkey": { "empcode": { "companyid": "FOO1", "employeeid": "000666" } }, "empleaves": { "empleave": [ { "empcode": { "companyid": "FOO1", "employeeid": "000333" }, "name": "AARDVARK, Alice MS", "candrill": 0, "shortname": "AARDVARK, Alice", "subposition": "", "subpositiontitle": "", "leavedays": { "day": [ "","","","","","","","","AL","","","","","", "","","","","","","","","","","","","","", "","","","" ] } }, { "empcode": { "companyid": "FOO1", "employeeid": "000335" }, "name": "AARDWOLF, Aaron MR", "candrill": 0, "shortname": "AARDWOLF, Aaron", "subposition": "", "subpositiontitle": "", "leavedays": { "day": [ "","","","","","","","","","","","","","", "","","","","","","","","","","","","","", "","" ] } } ] } } }

Well, there were a few problems. The first of which was that the admins could provide test data, but they couldn't provide any documentation. It was, of course, the leavedays field which was the most puzzling for Duncan. On the surface, it seems like it should be a list of business days within the requested range. If an employee was absent one day, it would get marked with a tag, like "AL", presumably shorthand for "allowed" or similar.

But that didn't explain why "AARDWOLF Aaron" had fewer days that "AARDVARK Alice". Did the list of strings somehow tie back to whether the employee were scheduled to work on a given day? Did it tie to some sort of management action? Duncan was hopeful that the days lined up with the requested range in a meaningful way, but without documentation, it was just guessing.

For Duncan, this was… good enough. He just needed to count the non-empty strings to drive his timesheets. But he feared for any other developer that might want to someday consume this data.

Duncan also draws our attention to their manager, "GOLDFISH, Bob MR", and the "style" tag:

I'm fairly sure that's a hint to the UI layer, rather than commentary on the Mr. Goldfish's management style.

[Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!

This post originally appeared on The Daily WTF.

Leave a Reply

Your email address will not be published.