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.

Aug 2013

Today's Article is Brought to You by the Letters "WTF"

by in CodeSOD on

Children’s show “Sesame Street” famously ends each episode with a message along the lines of, “Today’s episode is brought to you by the letter ‘B’.”

The alphabet is the first thing that’s drilled into us when we’re learning our native language. Brenden’s co-worker definitely understands the alphabet. Their grasp of loops and conditionals on the other hand…


There and Back Again

by in CodeSOD on

In an office cubicle, there worked a programmer. Not a nasty, dirty cubicle in the basement, nor a dry, bare cubicle in a vast faceless farm: it was a web startup cubicle, and that meant comfort. It was decorated brightly, with plenty of monitors and cables, a pantry full of all manner of crisps known to programmer-kind, and posters of films that were adaptations of a single book, broken needlessly into multiple parts.

The programmer was a well-to-do programmer, and his name was Anders. He was part of a coding team, and their team had worked on The System since time out of mind. It was a very respectable codebase, because it never did anything unexpected: you could tell what any function's output would be without the bother of calling it. Unit tests were a thing to be done by other folks!


Don't Be Evil

by in CodeSOD on

Many things in life can be joined. You can join two pieces of wood to construct something useful. You can join a club. You can join with a person of your choosing. Joins can be good things. Sometimes...

Doug K. was working on utilities to manage applications. Among other things, this would entail keeping track of which administrators were responsible for each application. As a first pass, the developers came up with a table like so:


Email Hyper-Validation

by in CodeSOD on

"The quickest way to advance around here is to get some project management experience under your belt!" was the advice Andrew's boss handed out along with an assignment to work with the offshore group.

The task was meant to be a super simple project to get his feet wet working with the remote team - add validation to the email address field on a vendor profile screen used by the purchasing group.


Don't Touch That Dial!

by in CodeSOD on

You can't really blame Bjørn for not listening to the radio much anymore. If you'd had to spend months maintaining the in-house web application he inherited, you'd develop some negative associations of your own.

Bjørn was always baffled by the occasional complaints he'd receive from users, reporting that the filtering and categorization functions on many of the application's pages were broken. The pages displayed sets of radio buttons to allow users to select among various options, and apparently these buttons didn't always work. The problems always had hazy descriptions and, no matter what, Bjørn had never reproduced a single one.


Galapagos

by in CodeSOD on

When Darwin visited the Galapagos, he saw that the relative isolation of the islands had allowed species to evolve into forms that would never have happened on the mainland. This insight helped him to refine his theory of evolution by natural selection.

Roberto had a similar experience, when one of his co-workers went on vacation . This co-worker didn’t work on any of the regular teams, and spent all of their time working in isolation on projects no one else ever touched. Roberto found something certain to give even Darwin's finches nightmares.