Feeds

How to spot a coders comment

This topic was created by Parax .

Bronze badge

How to spot a coders comment

So you can spot a T-SQL coder's comments because he uses 'single' instead of "double" quotes.

A TCL Programmer uses {Braces} instead of (Brackets).

I'm wondering how many other good tells for other languages are out there?

0
0
Gold badge
Joke

Re: How to spot a coders comment

Well, obviously a "C" programmer's comment will have made sense to them when they wrote it but, while syntactically and grammatically correct, will be impenetrably unintelligable to anyone trying to make sense of it later.

23
1

Re: How to spot a coders comment

"Well, obviously a "C" programmer's comment will have made sense to them when they wrote it but, while syntactically and grammatically correct, will be impenetrably unintelligable to anyone trying to make sense of it later."

I think that might be Perl you're alluding to - surely the king of write-only languages.

6
1
Silver badge

Re: How to spot a coders comment

Perl has comments?

i thought the only comment you ever got in Perl was "?????? WHAT the F$%& ????" - which incidentally is a valid Perl program

13
1
Silver badge

@Tim

A perl programmers comments would be written in abbreviations and punctuators, using "$" instead of"this" and "@" instead of "these" or die "not perl $!";

2
1
Anonymous Coward

Re: How to spot a coders comment

As distinct from a Java coder's comment which tends to look like this:

/**

*foobar

*this function bars Foos and returns a Snafu

*@param bar a Bar

*@param foo a Foo

*@return a Snafu

*/

private Snafu foobar (Bar bar, Foo foo) {

//Create a new Snafu passing bar and foo as parameters

Snafu snafu = new Snafu(bar, foo);

//do something with the data

snafu.doSomethingWithThe Data();

//now return the Snafu object

return snafu;

}

I think they get paid by the line, including comments

14
1
Bronze badge

Re: How to spot a coders comment

Not if the Tcl programmer wants his [comment] to be evaluated.

1
0
Silver badge
Trollface

Re: How to spot a coders comment

But, as this is Java, you've unfortunately forgotten the SnafuFactory.

8
0
Silver badge

Re: How to spot a coders comment

I think they get paid by the line, including comments

I do a lot of Java. I doc the shit out of my method and class headers, because it makes code inspection and merging later far easier, and the IDE will pick up on them. Within my methods though, I keep the comments to what's required. I go with the philosophy that comments should not explain what you're doing, but rather why you're doing it.

1
1
Anonymous Coward

Re: How to spot a coders comment - @Dan 55

I retire today, it's someone else's problem from here on.

1
0

This post has been deleted by its author

Joke

REM

I take it the BASIC guys were big fans of the yet to exist rock band!

6
0
Silver badge

Re: REM

10 REM my comment

?ONTOLOGICAL ERROR - ENOBAND

2
0
Silver badge
Go

Who writes comments

A Linux programmer - "Comments are for newbies."

A Windows programmer - There is no point in writing comments because the language of the day changes far too often. ( 6 months is already an old coding library - .DotNet - no problem, which version/sub version, MFC anyone, WIN32 -- WTF is WIN32).

A Cobol programmer - If someone needs to read comments to understand Cobol , they also need to change their profession.

A RPG programmer - Does anyone still code in RPG......

A Basic programmer - No need to write comments , they never get further than line 20

10 : Print "My name is Michael"

20 : Goto line 10

An HTML programmer - <!-- This is commented out -->

4
1
Gold badge
Coat

Re: Who writes comments

Does anyone still code in RPG......

There are a lot of indicators that this still goes on.....

5
0
Anonymous Coward

Re: Who writes comments

I once had the job of rewriting a program written on a BBC micro to control a test instrument, using BBC Basic and written by a physicist. It needed to add an auto calibration routine and some data logging, but it did the job.

The program was beautifully written and well commented. It was a pleasure to work with, the best piece of code I had seen in years.

But I soon fixed that. We can't have these non-programmers coming in and raising the standards.

7
0
Bronze badge

An APL coder would be an Egyptiologist

3
0

I write comments

In fact I've just written one, right here.

0
0
Gold badge
Happy

Re: I write comments

Hmm, you must have worked here. Much of our shonky old code is littered with pointless comments that state the bleedin' obvious.

6
0

My favourite comment

discovered when investigating a program that wasn't quite working correctly (and the original programmer had left)

* REMEMBER TO PUT SOME PROCESSING IN HERE

6
0

Re: My favourite comment

This just happened to me!

Except that the comment was less obviously a "to do"

two end cases to handle in an algorithm, he handled the second, but had the detection for the first as well. The comment said something like "increase gain here" followed by several lines apparently modifying some gain parameters (but not actually increasing anything).

d'oh.

0
0
Silver badge

Re: My favourite comment

assert( false && "unimplemented" );

2
0
Silver badge

Re: My favourite comment

Which is why one of the last things I do before committing any code is have the IDE look up any @todo tags in my current module. ;-)

Think my favourite comment was from my old boss, who left in one class:

"I think I've got this working, but then it was written by <ex programmer>, and <ex programmer> was a lazy incompetent twat."

3
0
Anonymous Coward

Re: My favourite comment

I've left comments like that.

Worked with a lazy shit once who never documented the IP addresses assigned to 3rd party VPN NAT pools, so I used to mark them as..

"<the lazy twat> has assigned these addresses to someone - I suggest you ask him. [date]"

6 months later the file was still full of them - I think it's still that way to this day. God help anyone trying to audit them. (This was for a well known internet bank as well).

0
0

Re: My favourite comment

// TODO: remove this - it's fundamentally unmaintainable

2
0

mainframe

Mainframe programmers use fixed width 80 char replies .

1
0

Re: mainframe

True IBM mainframe programmers don't use columns 73-80.

5
0

Re: mainframe

True IBM mainframe COBOL programmers don't use columns 1-6.

1
0
Coffee/keyboard

Re: mainframe

program Register( input, output);

begin

{ CDC mainframe BASIC programmers use columns 72-80 to store line numbers }

end.

0
0
Gold badge
Unhappy

Or that one found in the source for a compiler.

"This code is cursed."

1 of about 3 comments in the listing.

2
0
Anonymous Coward

// 01/10/2010 temporary fix.

Obviously, it's still there.

2
0
Silver badge

//see spec pg 20 par iii

/* most lucid comment ever before code was refactored but miss

ed the line feed*/

0
0
Anonymous Coward

Java

new SpringObjectMappableCommentFactory().troll();

4
0
Anonymous Coward

No comment

//

The post is required and must contain letters? Eh? WTF?

0
0
Silver badge

Programmer Forth

Comment Forth easy spot. Green if Yoda might be however.

5
0
Silver badge

Re: Programmer Forth

: its not the " word order" that gives away a forth programmer ;

its the " spaces" .

3
0

Not about comments but...

This thread reminds me of the user who phoned me one day many years ago saying an error message had appeared that he didn't understand. It read:

"IT IS LOGICALLY IMPOSSIBLE FOR THIS MESSAGE TO EVER APPEAR".

5
0
Silver badge

Re: Not about comments but...

We were integrating some code from a third party once, and one of the developers found code which alloc'ed memory, and if it failed executed:

printf("Fuck me! No memory left\n");

exit (1);

He sent mail to the team asking "Should we change this?", to which our manager immediately replied "Of course, it isn't internationalized".

Ah, for the fun days programing for a young company with money :(

6
0

Re: Not about comments but...

I've used that kind of thing, and seen the errors appear for real an enhancement or two later.

It anticipates the possibility of future code change, as in a class you intend always to be overridden, but implement stubs for. Or even simpler, this sorta thing:

enum { foo, bar } x;

...

switch (x) {

case foo: do_something; break;

case bar: something_else; break;

default: fputs("BUG: unhandled enum value in ...", stderr);

}

0
0
Anonymous Coward

Re: Not about comments but...

I did once have a customer contact me and ask why he'd gotten the error message "Well, you fucked that one up, didn't you you twit?" Turned out his server environment wasn't configured properly, so a should-never-happen condition...happened. Fortunately, the customer had a sense of humour and I got away with it.

0
0
Headmaster

Re: Not about comments but...

should be

fprintf(stderr, "Fuck me! No memory left\n");

0
1
Silver badge

Re: Not about comments but...

While testing software at a place I used to work at a million years ago, a windows mode (back in the DOS days) program if run under DOS would result in "This program must be run under windows" or words to that effect.

Except this one: "This program must be run under windows you dumb fuck" or words to that effect.

I don't remember if we found out about it first, or the client(s), the programmers probably had a few stern words said to them though.

0
0
Anonymous Coward

Re: Not about comments but...

should be

fprintf(stderr, "Fuck me! No memory left\n");

In the kernel?

0
0
Bronze badge

Passive-aggressive comments

In any sufficiently large team, there is usually a snarky comment like "Well, I wouldn't have written it like that, so I've had to insert this hack to make it work. Thanks a bunch."

That's one of the more polite variants. Team morale is the first casualty.

0
0
Bronze badge

Some write only comments, not code

Years ago I had to port a rather large body of C++ code, with which I was completely unfamiliar, to Linux. At some point I came across a header file that was #included all over the place but contained nothing but a comment. It said, roughly,

// Since AIX has WIN32 API emulation now we can throw away

// the whole UNIX branch.

0
0
Alert

Assembler.........

INCX ; increment x

1
0

This post has been deleted by its author

Re: Assembler.........

... and the C version:

i++; /* increment i */

0
0
Bronze badge

Re: Assembler.........

And the English version...

"Please dear chap, can I have another of those lovely 'x' thingies?"

0
0
Silver badge

C++

// sa schimb

took a while to work that one out. Done by a coder friend who is sadly no longer with us :(

0
0

Page:

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon