Recent Articles

Aug 2005

Colored Logic

by in Feature Articles on

When developing software that requires a user interface, some of us strive for a Model-View-Controller architecture to ensure ease of change to the UI and data components. Others will couple their business and display logic a little more tightly, using variables and classes to go between the two. And then there are the few (Adam Courtney's colleague included) who use the color of a UI component to determine business logic and program flow ...


Horrible Orable Code

by in Feature Articles on

Orable ... as in Oracle .. get it? Eh, eh? Oh yes, Oracle fans can find that and all sorts of other creative puns over at the IHOC. But I didn't pick Matt's submission just so I could plug the club ... or even so I could share the obligatory Oracle Consultant link. No, today's code actually represents an impressive combination of both the use and avoidance of the built-in string padding function, RPAD ...


State Management

by in Feature Articles on

I look back at one of the first things I posted on The Daily WTF (tblState) and get a kick out of how naïve I used to be. Back then, most of the worst code I'd come cross would barley make an honorable mention. Back then, I would never have fathomed that code like Scott Neumann's submission even existed. Back then, I didn't fear that I will inevitably have to maintain code like this. Yeah, those were good times back then ...


Seriously, I'm A Genius

by in Feature Articles on

Steve B was kind enough to include a nice story with his submission. So, here it is, straight from Steve ...

We had a developer working for us years ago who was fond of telling people, "Guys, I'm a genius. Seriously, I'm actually a genius". A year or so after she left, we discovered that our nightly auto-build had become stuck while executing some test code - the process was just burning cpu. We gcored the process and found the routine that had caused the problem - a random number generator written by "The Genius." Thank goodness this routine was not part of our production code.


Real Programmers Build Their Own Form

by in Feature Articles on

The NIH (Not Invented Here) syndrome is generally too common of a phenomenom to talk about here (although cases of IHBLRIA are usually mentioned). When it comes to HTML forms and Javascript, the normal "NIH" thing to do is reimplement the GET method of the web browser's form in Javascript. But what you don't see too often is a programmer (like Michal Pasternak's predecessor) doing it with inline functions ... for every control within the form ...


Integration Nation

by in Feature Articles on

Dylan Tusler's official job title is Integration Analyst, so he was not surprised to be called in to look at the setup for one of their major new corporate applications. He had held hopes that this new application would herald a new age in integration at their organization. The vendors (Intertrode and Initech) promised that they would be implementing a fabulous new Enterprise Nervous System in order to support their new Service Oriented Architecture (and I'm sure what ever else is "in" these days).

Of course you know this wouldn't be posted here if it went smoothly. Intertrode said that Initech's developers were "monkeys" (which I'm guessing is a problem because they billed a bit more than PPI). Initech thought that Intertrode developers were elitist. No less, the vendors were able to coordinate and integrate.


Hexing Around

by in Feature Articles on

Yesterday's post was surprisingly difficult to compose. Here I was, presented with all of the code from an "open source" system that Taka's company purchased, and completely unable to compress its quality into the short bit we're all used to seeing. I decided to limit myself to just the encryption module, but even that was too saturated for a single post. Here's another function I came across from the code that I felt deserved its own post ...


Quantum Computering

by in Feature Articles on

A little while back, I posted a function that generated random hexadecimal-like strings for a GUID-like string to identify events. At first, I thought it (and the rest of the system that Taka's company purchased) was just bad code. But now that I look at it further, I'm stunned at its unbelievable complexity. I can honestly say that I've never seen code that is actually prepared to run a quantum computer, where binary just isn't as simple as 1's and 0's ...


Vari-Post 2000

by in Feature Articles on

Yes, that's right, I wrote "Vari-Post 2000." I'm actually the only person who never got tired of the some-really-big-number-with-the-occasional-XL-suffix fad. Anyway, as you may have gathered, it's time once again for a variety post ...

First up is a submission from Andrew Vos. I generally do my best to conceal the author of code posted here, but our submitter did take blame for this snippet. Note that he actually make it all the way to "Z" before shaking his, saying "WTF!", and starting over ...


SQL Injection Prevention 101

by in Feature Articles on

Louis' organization has some pretty standard coding policies. Two key policies are that database access is allowed only via stored procedures and that all code must be reviewed before being deployed to the testing environment. There's no exception to this, meaning that everyone's code, even the highly-paid consultants' code, must go through review. One of the senior consultants on the team recently submitted this code for review ...


Just In Case It's Needed

by in Feature Articles on

A. Murat Eren was browsing through the (open) source of a program called YUM (which, from what I can tell, has something to do with Linux, hot dogs, and a magical kitchen appliance called a "recipe maker") and sent in a little snippet from it. Now, there's nothing really wrong with the code. It's actually researched, written well, and commented. But none the less, I found it pretty entertaining ...


Safety In Numbers

by in Feature Articles on

I suppose one advantage to working with other people's code is that it's a good learning experience. Sometimes you walk away enlightened, "hey, cool! I didn't know you could do that!" Other times the lesson learned is something like, "I swear, if I'm ever this guy's boss, the only thing he'll be allowed to develop with is an Etch-a-Sketch." Jeffrey Johnson was fortunate to learn something a bit closer to the former after looking over his predecessor's code. He still can't believe how naïve he was for never checking for upper and lower case numbers ...


I Call It The "Click2"

by in Feature Articles on

Andrew Parsons has some pretty big shoes to fill at his company. Among many other revolutionary inventions, his predecessor single-handedly developed one of most innovative GUI elements ever seen: the Click2. What's so incredible about this is that it adds an entire dimension to selection via a computer mouse: if a user clicks one time ("Click") a different action is performed than if she clicks two times ("Click2"). Following is the (VB6) machinery behind this astonishing creation ...


Avoiding the dreaded Refresh

by in Feature Articles on

Today's WTF is pretty near and dear to me as I still work at the company Alex is talking about.  One of the complaints the developers always get (myself included) is that our pages post back to the server and that refreshes look "clunky."

The CMS on our web site is a huge WTF in itself.  It never posts back despite there being 7 sections, each with like 15-20 subsections, and each of those with 3 mini sections.  You're probably asking yourself how we did it.  Well, don't look at me, the code is a giant freaking mess and was developed by the same programmer behind tblCalendar.


1, 1, or 1, or if you really want, 1

by in Feature Articles on

Today's WTF is a never-before-seen, totally 100% new classic that first appeared on the site a few months back.

It's a two-for-one day today that, despite the title, doesn't actually have to do much with ones. Or twos for that matter. No, it's more a case of redundancy in redundant cases. Oy, I'm gonna stop narrating after that one ... here's the first sample from Tristan Harmer


SqlHtml

by in Feature Articles on

Today's classic WTF is an M.C. Escheresque journey into design that just... isn't... right.  This is the kind of code you'd expect to see scrawled on the walls of an asylum full of developers.  Without futher ado, here's the classic WTF of the day!

SQL XML? Pssh, been there, done that.


tblCalendar

by in Feature Articles on

Jake again, still covering for Alex.  Today's classic WTF comes from none other than a egocentric programmer named ME, originally posted a little over a year ago.

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.


Just in case SPACE isn't supported in the future

by in Feature Articles on

Jake here, in classic programmer fashion, late on the first update.  Anyhoo, we're revisiting some classic WTFs this week while Alex is on vacation or undergoing surgery or whatever he said he was doing.  So here's one of my personal favorite WTFs from Scott Elkin for you to read while wishing Alex a happy vacation or speedy recovery.

I'll admit it. When I first came across regular expressions, they seemed a bit intimidating. But, after spending about three or four minutes reading about them I felt a lot more comfortable. Apparently, Scott Elkin's colleague didn't feel like investing those three or four minutes learning regular expressions. Or looping through the individual characters on the string. Well ... at least this way it's all on one line.


The Brillant Paula Bean

by in Feature Articles on

Heidi S and Michael Hanson's employer was building an enterprise shipping/warehousing system but didn't have enough in-house resources to do it. One of the contractors they brought in to help fill the gaps was Paula, an "experienced Java programmer with strong knowledge of the shipping industry." For the first few months, things seemed to be going pretty well. At the weekly status meetings, Paula would report that good progress had been made and things were looking good for the deadline.

But as the deadline loomed closer, Paula reported that she was running into a lot of difficulties and would need some additional resources to finish up her piece. When Heidi and Michael came in to help, they realized gross of an understatement "some" was. Following is all of the code Paula had written for the application ...


Putingz A Hex Onz Youz

by in Feature Articles on

One of Taka's clients needed some fairly specialized software but didn't have the budget for a complete system from scratch. After a little bit of research, Taka found some software sold by a third party that would get them 95% of the way done. Better still, the vendor had an "open source" option to that allowed them to add-on and modify the source code for an extra licensing fee.

Now this may come as a complete shock to you, but things didn't quite go as planned. The reason the vendor was so eager to sell it as "open source" was because their software was written entirely in VBScript/ASP. And things just went downhill from there. GUID were used to track certain events and were stored in the database as VARCHARs (as opposed to UNIQUEIDENTIFIER). Not too bad on its own, but their GUID were filled with "Z"s ...


Reinventing The Round

by in Feature Articles on

In a language whose library functions include things like Rate (interest rate per period for an annuity), SYD (sum-of-years' digits depreciation of an asset for a specified period), and IRR (internal rate of return for a series of periodic cash flows), you would imagine that a VB6 programmer would think that maybe ... just maybe ... the designers of VB would be insightful enough to include a function that rounded off numbers. Apparently not all programmers (especially Steve's predecessor) have that kind of intuition. To be fair though, his function is a bit more convenient than Round: global variables are used instead of cumbersome parameters to specify the number of places and fractional portion of a number ...


The Phantom of The System

by in Feature Articles on
Mortimer Armstrong and his coworker had always known about The System: a gigantic order entry/processing applications written entirely in ASP/VBScript. The System was so fragile that something as simple as a misplaced "double-click" could bring the whole thing down. The code churning within The System was so intricate and complex that only "The Whiz" (who, consequently, was also the author of The System) could possibly understand and maintain it.

After The Whiz had left the company, The System fell into Mortimer's coworker's lap. Amongst countless other things, one thing that he was having such a hard time figuring out was the significance of the mysterious numbers 22, 7, -12, and 620 strewn throughout the code. Then he found this. Amidst 1600 lines VBScript order validation/processing code. With not a single line containing anything even resembling a function or subroutine.


When It's OK To GOTO

by in Feature Articles on

Everybody knows that you should never use "goto" statements. Well, except in one or two rare circumstances that you won't come across anyway. But even when you do come across those situations, they're usually "mirage cases" where there's no need to "goto" anyway. Kinda like today's example, written by Jonathan Rockway's colleague. Of course, the irony here is that the author likely tried to use "continue" as his label, but was forced to abbreviate it to "cont" in order to skirt compiler "reserved words" errors.