Two Guys Arguing

Programming Anti-Patterns: Releasing Cthulhu

Posted in Uncategorized by benjaminplee on 11.10.10

Some code is elegant.  Some code is a quick fix hack.
Some code is maintainable.  Some code release Cthulhu.

These are just a few gems I have found over the past year or so…


Math is for the Weak Pattern

if(result == 1) {;
else if(result == 2) {;
else if(result == 3) {;
else if(result == 4) {;

Subtraction is a poor abstraction;

Scare the Next Guy Pattern

// ... Base DAO containing transaction logic for whole application ...
if(connection.isOpen()) {

    // TODO:
// ... more complex TX logic ...

Because, what he doesn’t know … might be nothing … or might be something

Decoy Security Pattern

<pre>public Connection getNewConnection() {
    Long.Full.Package.Name.Connection c = new Long.Full.Package.Name.Connection();

    return new Long.Full.Package.Name.Connection();

No cups in this shell game, just database connections

Missing Father Pattern

try {;
catch(Exception e) {
    throw e;

If dad is never around, you end up playing catch with yourself

All codes have been modified and rewritten to protect the guilty.
Tagged with:

Get every new post delivered to your Inbox.