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.

27 May 2015

Reversing the String, Belaboring the Point

by Jane Bailey in CodeSOD on 2015-05-27

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.

43 Comments - Last Comment @ 15:26
25 May 2015

A Winning Strategy

by Remy Porter in CodeSOD on 2015-05-25

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

“What’s that?”

26 Comments - Last Comment @ 2015-05-26
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.

89 Comments - Last Comment @ 13:44
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};

74 Comments - Last Comment @ 2015-05-26
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?"

61 Comments - Last Comment @ 2015-05-26
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