Article 4HT8N CodeSOD: Classic WTF: Logical Tiers? That Makes No Sense!

CodeSOD: Classic WTF: Logical Tiers? That Makes No Sense!

by
Alex Papadimoulis
from The Daily WTF on (#4HT8N)
It's that time of year when we take a short summer break, and that means we reach back into the archives for some classic WTFs that remind us of when things were better. Or worse. So much worse. Today, we find out where checkboxes come from. Original --Remy

Some developers just don't believe in "standards." I should know, I used to work with some of them. They had their own way of doing things, from reinventing the database to changing the web paradigm. I always found it ironic that these folks have a pretty good knowledge of the tools, but could never seem to figure out how to use 'em. Like Chris' predecessor, who seems to have done the equivalent of tightening screws with a voltammeter.

Ok, so I had to port over an ASP app to Coldfusion MX. It was a simple set of search pages so I didn't think it would take too long. Problem was, I couldn't find anywhere in the code where the HTML for one of the select boxes was. Silly me, I should have checked inside the SQL Server stored procedure first! And of course, this is just the tip of iceberg on this site. There were stored procedures that were used to build the actual HTML for the dynamic navigation as well.

CREATE PROCEDURE GetDepartmentDropDownASIF ((SELECT COUNT(*) FROM Staff_DepartmentLink) > 0)BEGIN CREATE TABLE #HTML (src varchar(1000)) INSERT #HTML (src) Select '<SELECT name="DepartmentID">' INSERT #HTML (src) SELECT '<option value="-1" SELECTED>(None Selected)</option>' INSERT #HTML (src) SELECT DISTINCT '<option value="' + CONVERT(varchar(6), DeptID) + '">' + DepartmentName + '</option>' As src FROM StaffDepartments INNER JOIN Staff_DepartmentLink ON StaffDepartments.DepartmentID = Staff_DepartmentLink.DeptID ORDER BY src INSERT #HTML (src) SELECT '</SELECT>' SELECT src As 'rowsrc' FROM #HTML DROP TABLE #HTMLENDELSE Select '<i>No Departments Defined</i>' As rowsrc

otter-icon.png [Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today! TheDailyWtf?d=yIl2AUoC8zAvF0Fk2h49Zk
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments