Coffeehouse Post

Single Post Permalink

View Thread: Funny Code
  • User profile image

    I used to write funny code a long time ago.

    Then I discovered an important fact: People are reading your code to find out how it works because either it's

    a) broken

    b) An audit is taking place (e.g. because your company is being bought out, you failed a regulatory test such as losing customer details or because you want to persuade someone to trust your company for some reason)

    c) they (or you) need to change your old code to make it work on their new product.

    This means that they get really annoyed when the code is trying to be funny. If the code is broken and just lost you clients or got a customer hacked and you're reading code that makes it sound like the guy who wrote it wasn't taking his job seriously, it's really grating.

    Also your boss really doesn't like to see comedy comments in a report saying "this is the code that caused the reactor to malfunction" and your CEO is not impressed to read humorous comments next to the SQL injection that lost him his entire database of customers and the support of his shareholders, because he's wondering if, had you taken more trouble to write your code, he might not have to wear a suit and visit some lawyers today. And he might not have to write a letter to his customers telling them why his company lost their credit card details.

    So let me put it this way. If you want to make someone's life easier, make good, and well commented code. The guy reading your code has a job to do, and humour is distracting and possibly inappropriate. If you make good, clean, well commented code, it'll be easier for them to understand what's going on, easier for you to demonstrate competence and easier for you to write and maintain the code yourself.

    Nothing good ever came out of hilarious code. And many people have regretted it. Write your code as if your boss is reading it with his angry face on. It's really not worth it - and writing serious code will probably help you write better code too.