Ain’t this the dumbest code I’ve ever written?


txtContent.setCaretPosition(txtContent.getCaret().getDot());

Look at that! How does that happen? When you see logic written like that you have to wonder what goes through the developer’s mind as he keys it. I know, I know, in today’s age of modern IDEs you can sometimes blame the computer for writing stoopidity like that in an awkward refactor command or something. The difference is that I remember writing the logic. I remember what my intent was. I remember saying, “hmm… that doesn’t look necessary but it fixed the problem.” I was in some ugly code way deep at the time. Have you ever added something that you knew was dumb only to find out later how idiotic it was?

2 Comments

  1. Hmm. Sounds like code that needs a comment, like:

    // NOTE this makes XX happen.

  2. Here’s a comment for my above example:
    //This code moves the cursor to it current position
    //Verynecessary do not remove at the risk of world destruction!!!
    txtContent.setCaretPosition(txtContent.getCaret().getDot());

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 251 other followers

%d bloggers like this: