Never let college students write your code



  • Or you will end up with this.

    (various snippets in different languages from different projects):

     

    1. 	div.c-c-c-combobreaker {
      clear: both;
      }
    2. 	// My name is Jobs. Steve Jobs.
      private Jobs Jobs { get; set;}

    3. 	throw new EndOfStreamException("We have reached the ocean.");

    4. 	[SetUp]
      public void ReallyBoringCopyPasteSetupMethod() {
      ...
      }

    5. 	/**
      * HE WHO CONTROLS THE SPICE,
      * CONTROLS THE UNIVERSE!
      */
      public class SpiceValueParser {
      ...
    6. 	... } else NeedsRecreation = true;

      //Everything's okie
      if (!NeedsRecreation) return;

      //Not everything's okie

    7. 	int columnCount = -1; //if this stays, we're doomed
    8. 	private static object M = Missing.Value; //Missing value
      private static object MINUS_ONE = -1; //YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY
      private static object WDFITWINDOW = WdAutoFitBehavior.wdAutoFitWindow;
    9. 	
      // read first line AND IGNORE IT (MUHAAHAHAHA)
      r.readLine();

      while ((line = r.readLine())!=null) {

    10. 	LoadedProject._isWorkingCopy = false; //funfact : I haven't really thought this through so we're never actually working on a working copy.
    11. 	if(!result.Success) //We failed
    12. 	} catch (SerializationException)//Serialization FAIL
      {
      ...
      }
      catch (SecurityException e) // Access FAIL
      {
      ...
      }
      catch (IOException) // Disk FAIL
      {
      ...
      }
      catch (TargetInvocationException) //Version fail?
      {
      ...
      }


  • At least most of those comments are more helpful than these:

    # Change Tab
    $game_system.se_play($data_system.cursor_se)
    # Reset color tone of the old category
    self.cat = @cat + Input.dir4 - 5
    # Btw, did you realize how retarded these comments are?


  • Whose old code were you looking at?  I haven't seen number 1 or 12 before, but 2-11 looked very familiar.  Like stuff I wrote about 15-18 years ago...  Except example 9 appears to have been converted from the original Perl, with some evil laughter added.

    Note: I'm not saying it was *good* code.  I agree completely with the sentiment - student coders have a tendency to produce student code.  You don't want that in production, if you are sane.



  •  This is why I use source code control as a buffer to do a code review... whittle down the changeset to the bare minimum needed with nothing extraneous.



  • #1 reminds me of the friday afternoon we got bored and rewrote our main stylesheet in lolcat.

    I'm also reminded of all the instances of the word fuck and other amusing comments in the linux kernel. But yes at least they are sane comments, even if full of expletives.



  •  Quite funny.  Reminds me of a time I named my .sql files things like "BCM I am going to kill Kevin Leonard's family.sql" because I hated the project that he had dropped on me.



  • From a test of a little IPC-related module which was once behaving poorly in an obscure corner-case. (dok here is the structure-comparison interface to the test harness.)

      # What father among you, if his son asks for bread, would give him a stone,
    # or if he asks for a fish, would give him a snake instead of the fish?
    dok( $hash_space->get('fish'), ['fish', 'coffee-klatsch-aragonspath'] );
    dok( $hash_space->get($snake), [$snake, 'blargh!'] );

    Yes, at one point get('fish') was returning the $snake. Oh! Speaking of which, before, during the setup....

      my $snake = "ooh, snake!"; # snaaaaaaaake!


  • @tgape said:

    Whose old code were you looking at?
     

    It's not old code. It's a mix from several projects I've been involved in the last several months.



  •  Only funny comment of mine in the pastyear:

    I've made like a baker and done up a cookie.



  • It reminds me of the time we had an application written by a 15-year-old. Who also happened to be the MD's son..  Among other, er, "issues", all the variables were named after his schoolfriends. Maintain THAT, suckers!



  • @Cantabrigian said:

    It reminds me of the time we had an application written by a 15-year-old. Who also happened to be the MD's son..  Among other, er, "issues", all the variables were named after his schoolfriends. Maintain THAT, suckers!
    How hard is it to remember that morbiuswilters is the object that whines about all the other objects and dhromed is the mediator object and bstorer is the Object That Can Not Be Destroyed?  

    Also, there's a He Who Shall Not Be Named object, an object named Welbog that does all your math for you.  Then there's a tster object that mutilates the English language, and is in love with the TunnelRat object.

    See, how hard was that?


  • Discourse touched me in a no-no place

    @dhromed said:

     Only funny comment of mine in the pastyear:

    I've made like a baker and done up a cookie.

     

    While not funny-haha, this one gave me some cause to go WTF??! (Context: Written in the last year, language is C (if it matters,) this programmer is no longer with us.)

    /*
     * File:   [file].h
     * Author: [elided]
     * Language: C using C99 coding standards and Kernighan, Richie and Pike coding style.
     * (your credibility is in jeopardy if you criticise K&R or K&P)
     * Keep typedefs of struct to a minimum, they are not cool and hide the real types.
     
     
    Created on [sometime in the past year]
     */



  • @belgariontheking said:

    an object named Welbog that does all your math for you
    It only has one static method, called "doAllTheWork" which takes an array of objects as a parameter and outputs vastly different results based on the types and order of those objects.

    Then there's the belgariontheking class, whose "getReply" function takes a string as input, ignores it and outputs a random link to a gaming article you've already read.



  • @belgariontheking said:

    dhromed is the mediator object
     

    Oh fuck off, you cunt.



  • @Nyquist said:

    I'm also reminded of all the instances of the word fuck and other amusing comments in the linux kernel. But yes at least they are sane comments, even if full of expletives.
    Several versions of MediaWiki used to carry a comment which contained the memorable line: "Fuck you, PHP. Fuck you in the ear!"  I think the entire function has since been deprecated and removed, though.



  • char buf[9001]; //it's OVER NINE THOUSAAAAAAAAAAAAAND!



  • Admit it, the whole point of $snake is so you could write

    push @plane, $snake while true;


  • We don't get away with much but I did get away with this one. It took a few months before someone and that was only because they copied and pasted the header for another file:

    <FONT color=#008000 size=2><FONT color=#008000 size=2>//--------------------------------------------------------------------------------------
    // <copyright file="GlobalSuppressions.cs" company="***********">
    // <snip>
    // </copyright>
    // <summary>I'm globally supressed.</summary>
    //--------------------------------------------------------------------------------------</FONT></FONT>



  •  Yeah, that's not much at all. It doesn't even start with "Help! Help!"



  • But, is <snip> a valid tag? ;-)



  • @Welbog said:

    It only has one static method, called "doAllTheWork" which takes an array of objects as a parameter and outputs vastly different results based on the types and order of those objects.

    That sounds like the library I'm beating on right now. The API consists of one function:


    PASCAL(long) ControlWinProc (long hWnd, UINT message, WPARAM wParam, LPARAM lParam)

    The function consists of a 4000-line switch statement, and the meanings of "wParam" and "lParam" (untyped four-byte values) and the actual type of the return value vary depending on the value of "message". Incidentally, "hWnd" is a pointer, but it's only ever typecast to one if it needs to be dereferenced -- when passed around as a value, it's always done as a long.


  • @dstozek said:

    //funfact : I haven't really thought this through...

     

    Note to self: Use that one more often in my own projects and watch how my coworkers will react...

    @Carnildo said:

    That sounds like the library I'm beating on right now. The API consists of one function:

    PASCAL(long) ControlWinProc (long hWnd, UINT message, WPARAM wParam, LPARAM lParam)


    The function consists of a 4000-line switch statement, and the meanings of "wParam" and "lParam" (untyped four-byte values) and the actual type of the return value vary depending on the value of "message". Incidentally, "hWnd" is a pointer, but it's only ever typecast to one if it needs to be dereferenced -- when passed around as a value, it's always done as a long.

     

    Uuuh, maybe I overlooked something, but isn't that just the standard interface to Windows' window management system (argh)? I agree though, exposing that as an API is WTF.



  • @dstozek said:

    @tgape said:

    Whose old code were you looking at?
     

    It's not old code. It's a mix from several projects I've been involved in the last several months.

    That would explain why some of the code looked like languages that weren't around 15 years ago.  (Of course, one could have written C++ classes that allowed for such code, but...)

    That's the problem with kids these days.  They make the same mistakes1 I did when I was one of them.  The world is quite obviously doomed.

    1 Except that I bet none of them ever related to Equation Man that one could do just about any sound editing only using cat, GNU head and GNU tail.  But I made much bigger mistakes than that one - that was just minor.


  • Discourse touched me in a no-no place

     I've worked with college students on several projects now, and while some of them have been an outright PITA to maintain (those were the ones where they did all the design work as well as implementation), the vast majority are very clean.



  • @PSWorx said:

    @Carnildo said:

    That sounds like the library I'm beating on right now. The API consists of one function:


    PASCAL(long) ControlWinProc (long hWnd, UINT message, WPARAM wParam, LPARAM lParam)


    The function consists of a 4000-line switch statement, and the meanings of "wParam" and "lParam" (untyped four-byte values) and the actual type of the return value vary depending on the value of "message". Incidentally, "hWnd" is a pointer, but it's only ever typecast to one if it needs to be dereferenced -- when passed around as a value, it's always done as a long.

     

    Uuuh, maybe I overlooked something, but isn't that just the standard interface to Windows' window management system (argh)? I agree though, exposing that as an API is WTF.

    Yes, that was quite clearly the inspiration for this API.


  • @dhromed said:

    Only funny comment of mine in the pastyear:

    I've made like a baker and done up a cookie.

    [code]//I made you a cookie!
    setcookie("cookiecookie", "value");
    // But I eated it!
    setcookie("cookiecookie", NULL, -1);
    [/code]



  • @Arancaytar said:

    @dhromed said:
    Only funny comment of mine in the pastyear:

    I've made like a baker and done up a cookie.
    //I made you a cookie!
    setcookie("cookiecookie", "value");
    // But I eated it!
    setcookie("cookiecookie", NULL, -1);
    

    Put that cookie down! Now!


    Also: FTFY.



  • This was originally a line of Basic I wrote around 1986, but I don't remember the syntax, so you get it in C:

    if (scroll && noscrolll) // or tea and no tea

    ... there was a limit on variable name length, so the vars did actually refer to separate scroll-related things.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.