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.

Jul 2009

What Fundamental Underpinning?

by in CodeSOD on

Sascha was at wit's end. "It's a fundamental underpinning of the web! Server-side code cannot interact with the user's web browser and tell it to close the window. You have to do it in JavaScript!"

"Okay," Sascha's coworker smiled wryly, "not only can it be done, but I've done it! How's that for your 'fundamental underpinning'?"


A Peculiar System

by in CodeSOD on

Near the end of the new contractor’s first week, Taka Sora was starting to wonder if he made the right hiring decision. Richard – the contractor in question – seemed to know his Action Script 3, but there was just something about him that wasn’t right. And it wasn’t the strange noises that he was making all day.

Richard was brought on to build a Tournament Brackets module as part of a larger project for a major client. He seemed to have gotten a great start, which was one of the reasons Taka just learned to deal with the neighing and nickering sounds coming from his work area. But by the end of the week, Richard’s progress just stopped. His second week wasn’t any better, though each promised he was "just about done." And his third – and final – week proved to be just as unproductive as the last.


Synchronization by Modal

by in CodeSOD on

Bryan D recently started a new contract with a large company that was developing a rich client application with all the latest buzzword technologies: WCF, WPF, BDD, etc. He was brought on to clean up the code and help figure out why the middle tier wasn’t so “middle”. It actually lived in the UI.

The middle tier seemed pretty straight forward: it was a collection of classes that were designed to be exposed as webservices and then called by the UI. Each service class implemented an abstract Interface that had a pretty straightforward set of method.


The Four Dutchmen

by in CodeSOD on

"It's some nice code," smiled the software architect at Petr Valasek's company, "it needed refactoring before it was ever written. But the good news is, you get to refactor it now."

And just like that, Petr was a new father. His baby was the bastard child known as the GIS Hardware Monitoring module. It wasn't pretty, but Petr knew it had potential and was excited to refactor the code. One of the first things he came across was this.