The most accurate and informative source of information about software development and enterprise IT in the entire universe

Wednesday, April 1, 2009

Passive-Aggressive Design Patterns

Software engineers work with dozens of design patterns, but research shows that the most commonly encountered is the Passive-Aggressive Design Pattern. Known for its frustratingly obstructionist behavior, this design pattern can appear anywhere, but is most often found in applications deployed into unpleasant application servers or hostile data centers.

“This is one instance where some software definitely doesn’t play well with others,” said J. Marcus Wellington-Smythe IV, senior design pattern expert at the Institute for Software Behavioral Studies, speaking at a conference on April 1. “You code the module to execute a certain task or to carry out an operation using a specific algorithm, but instead you find that the module quietly just refuses to do its job.”

According to Wellington-Smythe, applications created using the Passive-Aggressive Design Pattern can be recognized by their many excuses about why things didn’t work out, as well as sincere assurances that things will be better next time. “You’ll see in the log that a buffer was full, or that there was a single-bit parity error. Perhaps a checksum didn’t match or network packets didn’t arrive. It doesn’t matter. There’s always something. The reality is that the routine doesn’t want to do its function, but won’t admit it to the CPU.”

In parallel-computing systems, the design pattern has been used to build multithreaded applications, with predictable results, says Wellington-Smythe. “Too often, a supervisor dispatches a thread to a core…and the thread simply never comes back, or returns much later without a good explanation and without the expected return code,” he said. “The supervisor might not even realize that the thread was simply stalling, just running out the clock.”

Wellington-Smythe pointed to a recent instance, where the Passive-Aggressive Design Pattern was used to architect a garbage collector for a virtual machine monitor. “Do you think that the garbage ever got collected? Yeah, right,” he moaned. “We had deallocated memory blocks everywhere, sitting around waiting to be picked up. You might call it learned helplessness, but all we heard from the collector was to trust it, it would get around to the task ‘soon.’ What a mess.”

Unfortunately, says Wellington-Smythe, once the Passive-Aggressive Design Pattern is in an application framework, no amount of refactoring will improve the software’s erratic behavior. “You can debug and profile and root-cause analyze until you’re blue in the face, but there’s no long-term cure,” he said. “It’s enough to drive you to abstraction.”

No comments: