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.
*/

 

Related Whitepaper:

Software Architecture

This guide will introduce you to the world of Software Architecture!

This 162 page guide will cover topics within the field of software architecture including: software architecture as a solution balancing the concerns of different stakeholders, quality assurance, methods to describe and evaluate architectures, the influence of architecture on reuse, and the life cycle of a system and its architecture. This guide concludes with a comparison between the professions of software architect and software engineer.

Get it Now!  

Leave a Reply


six − 2 =



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.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books