About Lukas Eder

Lukas is a Java and SQL enthusiast developer. He created the Data Geekery GmbH. He is the creator of jOOQ, a comprehensive SQL library for Java, and he is blogging mostly about these three topics: Java, SQL and jOOQ.

When Source Code Comments Indicate Trouble

Developers have their own, cynical kind of humour. Consider, for instance, Geek and Poke’s view on how to insult a developer.

But there’s a better humour than posting stuff on a website. There are source code comments. Because you can giggle now, write your witty remark, and wait for your coworkers to discover your sense of humour only 3-4 years later (when you’re long gone, working in another project, department, or company). Isn’t that the ultimate way to express cynicism?

For instance, I once encountered this fat piece of Javadoc in a previous employer’s legacy source code:

/**
 * NEVER EVER TOUCH THIS METHOD OR EVERYTHING
 * WILL EXPLODE!!!!!
 */

But the bug was in that method! A monster with around 500 lines and 80 characters of indentation! So I went and first fixed the Javadoc:

/**
 * NEVER EVER TOUCH THIS METHOD OR EVERYTHING
 * WILL EXPLODE!!!!!
 * ^^^^^^^^^^^^^^^^^
 * Chicken!
 */

If you have a couple of spare minutes (or hours) to read up other witty and cynical comments, dive into this awesome Stack Overflow question featuring the top 549 pieces of comment in code. An extract by Steve Weet.

I once came up with what I thought was an elegant solution to a particularly sticky problem, in retrospect it was a bit of a mind-bender and made some heavy use of macro programmimg. Years later I found this comment from a maintenance programmer

/*
The Total Perspective Vortex derives its picture of
the whole Universe on the principle of extrapolated
matter analyses.

To explain - since every piece of matter in the
Universe is in some way affected by every other
piece of matter in the Universe, it is in theory
possible to extrapolate the whole of creation -
every sun, every planet, their orbits, their
composition and their economic and social history
from, say, one small Macro.

The man who invented the Total Perspective Vortex
did so basically in order to annoy the IT
department.

Steve Weet - for that was his name - was a dreamer,
a thinker, a speculative philosopher or, as some
would have it, a slacker.

And they would nag him incessantly about the
utterly inordinate amount of time he spent staring
out into space, or mulling over the mechanics of
Chelsea FC, or doing spectrographic analyses of
macros.

"Have some sense of proportion!" they would say,
sometimes as often as thirty-eight times in a
single day.

And so he built the Total Perspective Vortex - just
to show them.

And into one end he plugged the whole of reality as
extrapolated from one macro, and into the other
end he plugged the IT department: so that when he
turned it on they saw in one instant the whole
infinity of creation and theirselves in relation to
it.

To Steve Weet's horror, the shock completely
annihilated their brains; but to his satisfaction
he realized that he had proved conclusively that if
life is going to exist in a Universe of this size,
then the one thing it cannot afford to have is a
sense of proportion.
*/

 

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


1 × = one



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close