// TODO: fix after I quit
June 30, 2009 5:39 AM   Subscribe

 
Much of the software i've seen is totally devoid of comments other than the occasional // FIX ME. What happens then? A blank stare?
posted by ubiquity at 5:46 AM on June 30, 2009 [2 favorites]


Tomcat 4 looks pretty nasty but the team seem much happier with how Tomcat 5 and 6 turned out.

This is a strange interpretation, because the Tomcat 4 looks a lot like what the Synesketch wiki says happiness looks like, extremely strong happiness at that. And the Tomcat 5 and 6 pictures look like surprise.
posted by bjrn at 5:46 AM on June 30, 2009 [1 favorite]


Show me on the graph where the software touched you.
posted by The Whelk at 5:47 AM on June 30, 2009 [17 favorites]


Yeah, neat idea but has the wrong interpretations. Weird thing to get wrong.

I can't run Java at work, but synesketch has an online demo.
posted by DU at 5:51 AM on June 30, 2009


I keep seeing the die() function, but I'm not sure if the source is depressed or homicidal.
posted by eriko at 6:01 AM on June 30, 2009


Much of the software i've seen is totally devoid of comments other than the occasional // FIX ME. What happens then? A blank stare?

Hopefully, what happens next is whatever needs fixing gets fixed.

I always loved inheriting legacy code and reading the internal comments, left behind like graffiti from an ancient civilization of programmers. Sometimes a vital warning screams at you from the top of a routine, etched in fire and if source code could blink, it would:

# LEAVE THIS ALONE or you are FUCKED!!

or one that radiates smug throughout:

# If you are not sure what flock does, please stop right now
# and go find a nice grown-up to help you.


Sometimes you get a nice one-liner at the end of a particularly gruesome regexp and/or kludge:

/* and then a miracle occurs... */

Or just a little bit of self-deprecation:

# I'm really sorry you had to see that.

Wonder how the mood painting would interpret that.
posted by Spatch at 6:28 AM on June 30, 2009 [14 favorites]


Perl should be paying for my Wellbutrin.
posted by jmmpangaea at 6:35 AM on June 30, 2009


  ### This is just ridiculous, three global hashes so that 
  ### I don't have to lookup page_ids.  Broken window, it 
  ### was broken so why not just do more of the same, sigh.
Luckily, this is legacy code that one of my brilliant co-workers has spent a lot of time refactoring and rewriting. The rewrite is in QA as we speak. So there will be no more global hashes anymore!
posted by Plutor at 6:41 AM on June 30, 2009


Tried the demo and apparently my code is just as surprised as I am that it works.

and then a miracle occurs... indeed.
posted by hoppytoad at 7:01 AM on June 30, 2009 [1 favorite]


I've seen the equivalent of this many times:

// This is a terrible way to do this, but it works
posted by octothorpe at 7:01 AM on June 30, 2009 [5 favorites]


I mostly enjoy comments that go by the way of
// Seriously, I was forced to do that
in front of code that can't be healthy at all. I once left a
Help, I'm stuck in spaghetti
for whoever the poor soul is going to be who has to refactor my mess.
posted by dominik at 7:07 AM on June 30, 2009 [2 favorites]


When reading code, I usually just ignore the comments anyway. They take too long to read, and half the time they're out of date. 9 times out of 10 it's faster and easier just to read the source.

(The one exception to this is legacy code where there's some sort of hack or kludge or magic number, in which case you MUST read the comments lest you fall into an infinite pit of despair. Code like that should be avoided at all costs.)
posted by Afroblanco at 7:14 AM on June 30, 2009 [2 favorites]


You'll need a Unix machine with a C99 compiler and JDK 1.6.

Programmers have always got to be so hardcore, even about an elegant art project like this.
posted by crapmatic at 7:16 AM on June 30, 2009


The best ones are pre-emptive, even before you start coding the algorithm that you've told your non-technical users will never in a thousand years do what they want it to do:
// Forgive me for what I'm about to do
[horrible regexp]
For various values of 'best'.
posted by Mayor West at 8:05 AM on June 30, 2009 [1 favorite]


#!/usr/bin/perl

my $eyes;
theGoggles->nothing();
posted by DreamerFi at 8:23 AM on June 30, 2009 [18 favorites]


Actually, the REALLY best ones are where the code is a terrible mess and there IS an up-to-date comment, but you can't figure out the relevance of the latter to the former. I find this a lot in code written by non-programmer technical people. They explain the CS parts ("I'm setting a variable!") but leave out the science parts that a future maintainer will need to know.
posted by DU at 8:26 AM on June 30, 2009


Related (scroll down to see some suggested searches)
posted by mkultra at 8:42 AM on June 30, 2009 [1 favorite]


What DU said about explaining the language. I love seeing comments like:

# setting a flag
flag = True

# looping through the lines
for line in lines:
....
....

# checking the flag
if flag:
.....



You see that from fresh-outs who's professors kept telling them to comment everything but they don't know how to filter out the obvious.
posted by octothorpe at 9:05 AM on June 30, 2009


lolcomments. BTW, the visualization we're all here to discuss deliberately ignores code comments. I'm sure you all read the web page linked, but just in case..
The program ignores documentation comments, because those are written for public consumption. I'm only interested in the comments used for private communication between team members.
It strikes me that check-in descriptions might make a more interesting data source than function and variable names.
posted by Nelson at 9:06 AM on June 30, 2009


Since it's all java, I think he means the thing filters out javadoc comments, which are block comments which start with /** instead of /*. It would still use all single-line comments like //sets flag and so on.
posted by bjrn at 9:22 AM on June 30, 2009


I think the most pessimistic comment I ever put into something was:
/* ---------------------
This is the messiest code I've ever produced.
But that doesn't matter, as it's clearly been spec'd as
a quick'n'dirty throwaway project that'll never be reused.

If you're reading this, that's been disregarded.
Quit your job, leave the country, fake your death,
whatever it takes to avoid working on this file.
--------------------- */
and the best line of code I've ever typed has to be:
if (!predator._visible) gameOver.man.gameOver();
posted by malevolent at 9:30 AM on June 30, 2009 [30 favorites]


It's really helpful to have a Rorshach generator for my source code, thanks. Eliza might be helpful too, to talk about the feelings caused by seeing your source code looks like vomit.
posted by Pronoiac at 9:36 AM on June 30, 2009


I think he means the thing filters out javadoc comments

Oh yeah, that makes more sense than what I was saying.
posted by Nelson at 9:46 AM on June 30, 2009


Yeah, I have some comments in the janitorial log that are along the lines of "by god if we're still running this in 2012, you have my sympathies" vis a vis special handling for leap years. And my favorite self-comment is always something along the lines of "yeah, this works, don't worry", even though I still end up checking the code, unsure if I made a change that invalidates that.
posted by Kyol at 10:01 AM on June 30, 2009


I *wish* the devs here would write any comments at all. Even the javadocs look like:

/**
*
* @param i An integer
*
**/


Humor and/or pathos would be like so much gravy.
posted by Fezboy! at 10:23 AM on June 30, 2009


It strikes me that check-in descriptions might make a more interesting data source than function and variable names.

Definitely. I see emotive comments more frequently in check-ins than in the code itself.

One time I was working on an application, and I wrote a comment at one point in the code saying:
// Presumably, we don't need to call 'x' method again here, as we did it above.
Some developer comes in behind me, leaving my comment, and adding his own, saying:
// This assumption is WRONG. We always need to call 'x' method.
except longer, more involved, and then re-adding the method call. My favorite part about it? In the process of adding one line of code (and a paragraph of chastising comments), he still managed to independently break the code entirely.

If I didn't know better, I would have thought this to be the origin of the phrase, "Christ, what as asshole."
posted by Brak at 12:25 PM on June 30, 2009


Definitely. I see emotive comments more frequently in check-ins than in the code itself.

i looked through my SVN log. its only me coding so all comments refer to yours truly:
r121 | mach5 | 2008-03-17 23:35:18 -0400 (Mon, 17 Mar 2008) | 2 lines
i cant believe you were this dumb. fucking a.
r279 | mach5 | 2009-04-13 23:18:00 -0400 (Mon, 13 Apr 2009) | 1 line
here goes fucking nothing!
r325 | mach5 | 2009-05-08 22:11:58 -0400 (Fri, 08 May 2009) | 2 lines
you are just not a good programmer.
r196 | mach5 | 2008-10-03 07:50:28 -0400 (Fri, 03 Oct 2008) | 2 lines
fixed page. wow, that was fucking dumb. answer came to me in the shower

[mach5@black-death project365]$ svn log | egrep -i 'fuck|shit|dumb|stupid|ass|bitch' | wc -l
25

out of 357 commits, i curse in approximately 7%. fuck!
posted by Mach5 at 12:29 PM on June 30, 2009 [2 favorites]


And those are only the comments that the end user will never see. I do a lot of Actionscript programming, running the debug version of the Flash player and keeping a tail on the logs. Just browsing around in the web I can see all kinds of traces. Some examples:

Obvious and useless: Mefi music player letting you know every 1/30th of a second that 1/30th has elapsed.
Evidence of bad coding: The youtube video player throws hundreds of warnings for undefined methods and variables.
Depressing: I keep a log of these. Some examples are "Why flash why?!?!?!?!? Seriously? This is where you want to go?", "QA: If the player sprite is missing at this stage, go take a dump on the foyer floor at 345 Park Avenue San Jose, CA" and, copy pasted from the logs, "FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK SHIT FUCK FUCK FUCK FUCK FUCK FUCK FUCK FLASH".

Me? After I realized this, I cleaned up my traces and now just output some nice ASCII art in case I forget to turn them off.
posted by dirty lies at 12:49 PM on June 30, 2009 [4 favorites]


Most of the comments are dry and boring but I found these in our code:


/**
* Tells the chart what chart to chart.
*
* @param chart a chart
*/
public void setChart(Chart chart) { ... }


# Abandon all hope ye who enter here.

# We were setting the name_dictionary, nothing to see here

# Loop a number of times.

# what's this?

# TODO: What does this mean?

# TODO: What is it?

# (Simple enough ey, TODO: remove useless comments in this function)
posted by sixohsix at 12:51 PM on June 30, 2009 [1 favorite]


mach5: Someone at work ran some numbers on 2 years of SVN logs and produced a chart of the most cussing devs and most common curses. The winner had .3 'FUCK' per commit, you are waaay behind the curve there.

I re ran the numbers including misspelled and foreign cuss words and was too embarrassed to publish the results. Cnut is not a flavor of C.
posted by dirty lies at 12:55 PM on June 30, 2009 [2 favorites]


This is not fun without the actual source and comments on display. Still a cool idea, though.

Now, if you want some amusement, grep for common swear words in the Linux source tree. Or read the Sun HME network driver:

/* NOTE: In the descriptor writes one _must_ write the address
* member _first_. The card must not be allowed to see
* the updated descriptor flags until the address is
* correct. I've added a write memory barrier between
* the two stores so that I can sleep well at night... -DaveM
*/


/* Welcome to Sun Microsystems, can I take your order please? */

/* Would you like fries with that? */

/* Anything else? */

/* Fifty-two cents is your change, have a nice day. */

And of course, the obligatory:

/* Only Sun can take such nice parts and fuck up the programming interface
* like this. Good job guys...
*/
posted by spitefulcrow at 1:19 PM on June 30, 2009


The most depressing comment I ever saw in code I had to work on was:
// I pity the poor bastard who has to try and debug this.
// I have no idea how that regex is doing what it's doing, and I wrote the damn thing.
// With any luck it won't be me who has to debug it again.
// Lots of love, twine42

Not the luckiest day I've ever had...


Worst from someone else was one I found in a live project:
// Todo : finish implementing this before we go live.
// $this->FixStupidSyncBug();

Was there any trace of a function called FixStupidSyncBug? Ha!


We're going to include CVS comments? I once got a bollocking from the Development VP for repeatedly putting "I fucking hate CVS" as my check-in comment.
posted by twine42 at 1:26 PM on June 30, 2009 [1 favorite]


The most depressing comments, I think, are of the form
// [name] [date]: This is horribly wrong / quick-and-dirty hack / will break / will scramble peoples' data! Fix it after [version] ships!
where, of course, version shipped a month or two after date, which is itself many years and many major versions in the past.
posted by hattifattener at 8:25 PM on June 30, 2009 [1 favorite]



catch {/* TODO */} // I made you a exsepshun, but I eated it.

posted by jimfl at 8:36 PM on June 30, 2009 [1 favorite]


I dunno about checkin comments. I often see (and am often guilty of): "fixed bug".
posted by cj_ at 9:32 PM on June 30, 2009


« Older Pirate AB   |   Advanced Spaceborne Thermal Emission and... Newer »


This thread has been archived and is closed to new comments