CodeSOD

Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.
« Nov 07

December 2007

Jan 08 »
Although I've taken the rest of the year off, I wanted to share a few fun classics this week. "Implements ISwissArmyKnife" was originally published on 2005-02-24, and never seems to grow old...
Although I've taken the rest of the year off, I wanted to share a few fun classics this week. "Because database drivers can be too complex" was originally published on 2004-07-09, and is just one of those WTFs you wish you could un-see...
Although I've taken the rest of the year off, I wanted to share a few fun classics this week. "Now That is a Way to do States" was originally published on 2005-01-31, and amazingly, no one has submitted a worse way to "do states" to this day...
Although I've taken the rest of the year off, I wanted to share a few fun classics this week. The Brillant Paula Bean was originally published on 2005-08-05, and never seems to grow old...
Although I've taken the rest of the year off, I wanted to share a few fun classics this week. What Is Truth was originally published on 2005-10-24.

Reverse Brute Force

2007-12-19
When David was approached by a colleague for an estimate on some PHP work, David insisted that he'd need to see some of the code first. The only background David had on the project was that it was a PHP site with a MySQL backend, and a pretty sizable user base.
When Chris M's company finally decided to rewrite portions of their decrepit C++ application, Chris was relieved. "Finally," he thought, "no more ridiculous, unnecessary classes and enumerations."
These days, having written about bad code for a few years now, it's pretty rare to uncover a new anti-pattern like the FOR-CASE paradigm, IHBLRIA, or RLB o'PCC. However, having seen snippet after snippet like todays two, I think it's finally time to identify the Null Understanding...

No Loop For You!

2007-12-12
When Mike's coworker left the company for greener pastures, Mike got stuck with maintaining all of his old projects. This wouldn't have been too bad if it weren't for a application that was developed using the BrillantML (as I'll call it). While Brillant ML is technically a programming language, a more apt description is "a few commands surrounded by an XML wrapper." Yes, it really is as horrid as it sounds.
Isaac S. recently started working for a certain online multiplayer game company, and noticed that his fellow developers were very meticulous about security.
Bob T. got sucked into one of those "maybe the new guy can figure it out!" problems, only to open the first page - and then subsequent pages - to see that all of the validation code looked like this...
As one of the more experienced C# coders in his group, Yakir is often asked programming questions. Recently, his colleague James asked him the best way to store hundreds of thousands of items in memory, to which Yakir replied "It depends on how you want to access your data. If you want to access your data by index, you should store it in an ArrayList. If its easier to store things as a key-value pair, then you should use a Hashtable."
« Nov 07

December 2007

Jan 08 »