How to spot a coders comment

This topic was created by Parax .

Page:

  1. Parax

    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?

    1. TeeCee 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.

      1. Tim Parker

        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.

        1. Yet Another Anonymous coward 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

        2. Brewster's Angle Grinder 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. Anonymous Coward
        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

        1. Dan 55 Silver badge
          Trollface

          Re: How to spot a coders comment

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

          1. Anonymous Coward
            Anonymous Coward

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

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

        2. Greg J Preece

          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. This post has been deleted by its author

    2. disgruntled yank

      Re: How to spot a coders comment

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

  2. LinkOfHyrule
    Joke

    REM

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

    1. Brewster's Angle Grinder Silver badge

      Re: REM

      10 REM my comment

      ?ONTOLOGICAL ERROR - ENOBAND

  3. Khaptain 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 -->

    1. TeeCee Gold badge
      Coat

      Re: Who writes comments

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

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

    2. Anonymous Coward
      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.

  4. BongoJoe

    An APL coder would be an Egyptiologist

  5. Thomas 4

    I write comments

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

    1. TeeCee 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. JulianB

    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

    1. Hungry Sean

      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.

    2. Brewster's Angle Grinder Silver badge

      Re: My favourite comment

      assert( false && "unimplemented" );

    3. Greg J Preece

      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."

      1. Anonymous Coward
        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).

    4. larryk78

      Re: My favourite comment

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

  7. Caff

    mainframe

    Mainframe programmers use fixed width 80 char replies .

    1. PassingStrange

      Re: mainframe

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

      1. John R. Macdonald

        Re: mainframe

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

        1. Daniel von Asmuth
          Coffee/keyboard

          Re: mainframe

          program Register( input, output);

          begin

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

          end.

  8. John Smith 19 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.

  9. Anonymous Coward
    Anonymous Coward

    // 01/10/2010 temporary fix.

    Obviously, it's still there.

  10. Tom 7

    //see spec pg 20 par iii

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

    ed the line feed*/

  11. Anonymous Coward
    Anonymous Coward

    Java

    new SpringObjectMappableCommentFactory().troll();

  12. Anonymous Coward
    Anonymous Coward

    No comment

    //

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

  13. Anonymous Coward
    Anonymous Coward

    Programmer Forth

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

    1. Brewster's Angle Grinder Silver badge

      Re: Programmer Forth

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

      its the " spaces" .

  14. Dale Vile, Freeform Dynamics

    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".

    1. Phil O'Sophical 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 :(

      1. Anonymous Coward
        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.

      2. Anonymous Coward
        Headmaster

        Re: Not about comments but...

        should be

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

        1. Anonymous Coward
          Anonymous Coward

          Re: Not about comments but...

          should be

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

          In the kernel?

    2. Nick Kew

      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);

      }

    3. John Tserkezis

      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.

  15. Buzzword

    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.

  16. T. F. M. Reader

    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.

  17. The Real Tony Smith
    Alert

    Assembler.........

    INCX ; increment x

    1. This post has been deleted by its author

    2. Mike Tubby

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

      ... and the C version:

      i++; /* increment i */

      1. Aristotles slow and dimwitted horse

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

        And the English version...

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

  18. Will Godfrey 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 :(

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