Recent 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.

May 2015

Reversing the String, Belaboring the Point

by in CodeSOD on

Laser module

The position had sat open for months now; the department was straining under the load of too many projects and too few developers, but the pool of candidates was rapidly shrinking. So when Cindy found a resume that looked halfway decent, she immediately recommended tossing them a programming test and scheduling an interview.


A Winning Strategy

by in CodeSOD on

“Hey,” Roberto said while pairing with an offshore programmer, “this problem would be easier to solve with the Factory pattern.”

“What’s that?”


Sea of SQL

by in CodeSOD on

Andy writes: “Operations reported that a query was taking a long time.  Even the 'developers' of this query didn't know why it was taking a long time.”

I tell ya, folks… some submissions, you just set down and back away slowly… then hunt up a magnifying glass and a bottle of aspirin.


Recruiting Desperation

by in CodeSOD on

When hiring programmers, recruiters will often try to be “clever”. Sometimes, this results in a memorable trick, like EA Canada’s job posting billboard.

EA Canada billboard which reads: char msg = {78,111,119,32,72,105,114,105,110,103,0};


Happy Little (Read-Only) Trees

by in CodeSOD on

Blossoming tree - painting by László Mednyánszky

"Joey," asked Ross of the new contractor, in a slow, careful voice, as though trying to calm a large predator. "Explain to me why the data tree has this read-only flag?"


And I Try, and I Try

by in CodeSOD on

“If you want to put everything under test, you have to write code like this.”

At least, that’s what Alex’s co-worker said to him, when Alex demanded an explanation for this block of code.


The Forest of Trees

by in CodeSOD on

Sally’s co-worker wanted to turn some data into HTML. It would flow from his application into client-side JavaScript which would build the DOM. He decided that it made sense to use a tree to represent the data as it’s translated.

The C# declaration of his tree looked something like this:


Version Logging

by in CodeSOD on

251220061158 (335194668)

When a system evolves and grows, it's usually necessary to identify various versions of software living in the wild. There are many ways to do that: some hide their version numbers in code, some keep them in configuration and metadata files, and others store them in the application's database.