Yesterday, Larry Osterman had to go and take the fun out of yesterday's WTF. So Larry (and everyone else) I hereby issue a challenge for you to justify the actions of Programmer X, as described by reader Jake:
I'll be the first one to admit that I'm relatively new to programming. "I'm relatively new to programming." There. So far be it from me to criticize what could well be a masterfully architected piece of software, so I won't color this. I'll just present the facts and let you, the reader, decide if a programmer at my company is stupid.
I was recently asked by the company to add some functionality to the employee calendar that Programmer X made. Specifically, they requested that the entries be downloadable as vcs files, so that they could be imported into Outlook for PC users, iCal for Mac users, and whatever Linux folks use to schedule their client meeti-- ... wait, no ... dates ... err ... parti -- ... umm ... social even-- ... aha, television shows.
Anyhoo, wading through this programmer's source code and table structures got a little odd. Here's a screenshot of the layout of tblCalendar.
If I had to pick my two favorites, they'd have to be datDate (just in case you don't know what datatype a variable called "Date" would be) and strIDWho. Even though the column name clearly describes what's in it, I'll entertain the vague possibility that some of you may not know what strIDWho contains. Why, it's a comma separated list of the IDs of staff members from tblStaff. Unless it involves the whole staff, in which there's a 0. Or if it involves someone outside the staff, it's a -1, a comma, and then a list of the names involved. Or a -2 for the entire programming department. Or a -3 for the entire web department. So a typical value in this column is "-2, 2, 4, 5, -1, Jim and Jane Douchebag."
The calendar itself is rendered entirely client side. The justification for this? The server isn't that much faster than our individual computers, so why should the server do all the work? And naturally, when a calendar entry is saved, a SQL command string is built client side (in Javascript) and sent to the server to update the database.
Jake also metions that the application wasn't one of those build & patch cases -- this was the architecture as concieved on day one.