Recent Articles

Nov 2009

Pretty Basic Validation

by in CodeSOD on

"For reasons beyond my comprehension," Kristof writes, "one of my coworkers has managed to keep his job after more than eighteen months of messing about. His latest project was to build an import feature in the admin module of our web application. The idea behind the feature was that the administrators could upload a tab-delimited text file containing a list of products, and the application would insert or update the products in the database."

"Of course, the import feature required some pretty basic validation," Kristof continued. "Is it actually a text file? Is it tab delimited? Are the columns correct? And so on."


Classic WTF: Smooth, Like a Factory

by in Feature Articles on

It's Black Friday! For those of you stuck at work (or not in the US), here's a fun classic. Smooth, Like a Factory was originally published on November 9th, 2006.


Daren S knew that his days were numbered. He was a troublemaker bent on changing The Way Things Were and The Director was hot on his tail. Though Daren worked discreetly, improving his coworkers' productivity a little bit at a time, it only was inevitable that The Director would eventually find out. One does not become The Director by letting such things slide.


A Random PHP Script

by in CodeSOD on

Some time ago when Michael was tasked with updating some of code on an old website, one file on the server caught his eye.

Amid an ocean of static HTML files, it turned out that there was exactly one PHP script. Not sure what to expect, he was surprised when he discovered that the script was entirely comprised of vanilla HTML save for one line.


Immutable Invoices

by in Feature Articles on

Back in the late-1990s, the Internet Service Provider where Simon C. worked was a mere micro-sized version of what they are today. Their website's original e-commerce system only needed to sell one thing — domain names, and a limited subset of them at that — so the shopping basket and invoicing parts of the system didn't need to be all that intelligent. They simply looped through each item ordered by the customer, displayed the description and prices of each one, and worked out the totals at the end. The whole process was so simple in fact that it made sense to the original developer to write the system so that the shopping cart and invoicing pages shared the same code.

Over time, the ISP grew in size to sell additional products such as new domain types and packages with a multitude of sub-products. Also, as the system grew in size, the site began running slower and slower. This gave Simon a reason to look into ways to improve the efficiency of the shopping basket and invoicing parts of the system.


Starring The Admin

by in CodeSOD on

We've all been there before. You spend all this time building a kick-ass, ultra-awesome, super-sweet web application and then you realize you need to build some stupid "administration" module that needs to do the boring, run-of-the-mill things like maintain users, groups, privileges, and so on.

There are several different magnitudes of complexity that can be involved with an administration module, ranging from the full-on set of tables including users, groups, roles, tasks, operations, etc., to a simple IsAdmin column on the users table. Actually, it turns out there's an even simpler way, and that Adam P's predecessor discovered and implemented it for their client's fairly large ecommerce website.


Protocol Droid Processing

by in Error'd on

"As much as I detest Novell GroupWise," wrote Ben P, "it is reasuring to that they use the much-loved protocol droid to process commands."


Introducing Bad Code Offsets

by in Feature Articles on

I have never written a bad line of code.

When I tell people that, they often scoff and offer replies like “so you’re not a programmer then?” and “let me guess, you’re a coding deity or something?” Well let me say, I am a programmer and I am not Codethulu, but in the same manner that Al Gore can fly around the world in a private jet without polluting, I have negated my bad code footprint through the purchase of Bad Code Offsets.


modHmm

by in CodeSOD on

"I was put on a new Microsoft Access project recently," Stuart A writes, "and I've slowly been finding my way around the system as the need arises (read: as bugs are reported). As my eyes drifted over the numerous modules, one stopped me in my tracks. It was a module named 'modHmm'. I guessed the programmer was in a ponderous mood?. So naturally, I had a look inside..."

Option Compare Database
Option Explicit

Global t1qq
Global t2qq
Global t3qq
...

The Standard Way

by in Feature Articles on

length matters.Michael P. was feeling pretty tense – and really, who could blame him?

Today was no ordinary day. He was in the hot seat, presenting to the Software Advisory Committee - a multi-disciplinary group responsible for rubber stamping any and all new production application installations at MegaBank.


For the Ease of Maintenance

by in CodeSOD on

Ryan Thompson works on a project where all database queries had to go through "stored procedures". Now before you call me out on extraneous quotes or wonder, so what's wrong with stored procedures?, I'm not talking about those kind of stored procedures. I'm talking about "stored procedures" — i.e., the technique developed by Ryan's predecessors for the ease of maintenance.

You see, in Ryan's world, there are hundreds of different procedures, each with a unique identifier such as FNACL0023 or ADUSR0012, all which are stored in a database table named "RawQuery", which, for ease of maintenance, contained the actual SQL queries to be performed. In order to call one of these queries, you'd need to call one of several actual stored procedures — Query0(), Query1(), Query2(), Query4(), Query12(), etc. — depending on the number of "parameters" needed by the query.


Currency Conversion

by in Error'd on

"Now I keep thinking," Staszek noted, "if I only had my 5 EUR bill left after my last trip to Slovakia, I could have exchanged it for +Infinity PLN and planned for retirement."


The Long Week

by in CodeSOD on

Turns out that I'm The Real WTF, since the Code SOD from earlier today was already posted... last week. Whoops; consequences of posting realllly late at night in a hotel room while at The Business of Software conference I suppose. Anyway, here's one that I'm pretty sure wasn't from last week.


"We recently started using a new CRM system," Gavin Watkinson writes, "and wanted to write some custom functionality for it."


Classic WTF: Don't Worry, We'll Fix It!

by in Feature Articles on

I'm at the Business of Software conference in San Francisco this week and thought it'd be the perfect opportuntunity to revisit a classic. Don't Worry, We'll Fix It! was originally published on November 28, 2006.


We're in a bit of a jam, an email to the support desk read, we accidentally ran an entire day's worth of transactions for 11 Oct 2009 instead of 11 Oct 2006. Can you fix this?


Reading Comprehension

by in CodeSOD on

"After nearly eight years working as a C++ developer," Rik V writes, "a certain coworker of mine was finally laid off. One of his jobs was to run an application that he wrote which would compare two directories and put any files that had changed into a third. This was a semi-frequent task, and one that he needed to devote quite a bit of time to each month. On his departure, the task fell to me."

"The first time I ran the application, I noticed that it was taking an exorbitant amount of time to complete. After five minutes, it barely scratched the surface of the directories, so I took off for lunch and returned later to see it took over forty minutes to complete. Curious as to how a directory comparison could take so long, I peeked at the code.


Unexpected Accessory

by in Error'd on

"While shopping for dishwashers," Eric Steele writes, "I came across a dishwasher that had a somewhat unexpected accessory."


Classic WTF: Keepin' It Cool

by in Feature Articles on
Keepin' It Cool was originally published on October 4, 2006

A few years ago, Phil was working as a developer on a wire transfer application at a large bank. To make sure that nothing technical would prevent the bank from extracting maximum amounts of money from its operations, every part of their system had a redundancy with fast failovers and clustering. In fact, there was even one server (and a backup of that server) whose only function was to monitor the other server and send notifications if anything fell out of the operations norm.

When a system or process failed, the monitoring server would page the on-call support administrator, who would then log in and restore the errant system to its rightful state. On rare occasions, an actual visit to the server room was required.


Slightly OverSQL'd

by in CodeSOD on

"A certain coworker of mine likes to do everything in SQL," Christoffer Hoel writes, "and I mean everything."

"Of course, since our management is non-technical, there's very little any of us can do aside from just toletarting the code. After all, his code runs about the same as ours... and that's all that matters, right?"


The Shoe-In

by in Tales from the Interview on

Once word hit that certain departments within South England Financial were going to be outsourced, employees naturally started to get a bit nervious. Being a contractor — and therefore exempt from any kind of nice severance package — Jon Kipper was determined to find a new job before the axe fell.

After about a month of tossing his resumé out into the world, Jon received a call from a very perky recuriter regarding a position that was almost a dead ringer to what he was doing. Although the position was in London — a good two hours from his flat by train — Jon liked the idea of working in the big city with all the glitz and glare.


The Utility Package

by in CodeSOD on

"It took months of low quality, late delivered code," Scott C writes, "but a certain coder on our team was finally let go."

"I was the lucky one assigned to clean up some of his old code and noticed that several classes of his made reference to a particular utility package. I opened the package and found a single class with 24 methods filled with sad code."