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.

21 May 2015

Sea of SQL

by Ellis Morning in CodeSOD on 2015-05-21

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.

77 Comments - Last Comment @ 20:06
19 May 2015

Recruiting Desperation

by Remy Porter in CodeSOD on 2015-05-19

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};

73 Comments - Last Comment @ 2015-05-20
14 May 2015

Happy Little (Read-Only) Trees

by Jane Bailey in CodeSOD on 2015-05-14

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?"

54 Comments - Last Comment @ 2015-05-20
11 May 2015

And I Try, and I Try

by Remy Porter in CodeSOD on 2015-05-11

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

96 Comments - Last Comment @ 2015-05-14
07 May 2015

The Forest of Trees

by Remy Porter in CodeSOD on 2015-05-07

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:

54 Comments - Last Comment @ 2015-05-14
05 May 2015

Version Logging

by Maciej Stachowski in CodeSOD on 2015-05-05

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.

24 Comments - Last Comment @ 2015-05-07