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:

2 Responses

Subscribe to comments with RSS.

  1. el_neunie said, on 11.10.10 at 10:39 pm

    I know where some of this came from. If only I too had taken the time to write some of these down.

  2. […] Tips: IE Caching Can Byte, Notes to self: Keep SVN in sync w/ Git The Poor Man’s Way, and Programming Anti-Patterns: Releasing Cthulhu.  Honestly, these were cop-out posts.  I know I will go back at reference them at some point, but […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s