10

The programming things I've seen in code of my uni mates..

Once seen, cannot be unseen.

- 40 if's in 10 lines of code (including one-liners) for a mineswepper game
- looping through a table of a known size using while loop and an 'i' variable
- copying same line of code 70 times but with different arguments, rather than making a for loop (literally counting down from 70 to 0)
- while loop that divides float by 2 until it's n < 1 to see if the number is even (as if it would even work)

..future engineers

PS. What are the things you've been disgusted by while in uni? I'm talking about code of your collegues specifically, I'm also attaching code of my friend that he sent me to "debug", I've replaced it with simple formula and a 2D distance math, about 4 lines of code.

Comments
  • 1
    BS undergrad was working on my project, specifically building a file reader and data organizer to run a simulation. Literally, read and check shit. Nothing more.

    End results:
    * 3000 lines, single file
    * Data structures made no sense
    * No checks on input validity/units of measurements
    * DINAMICALLY ALLOCATED ON RUNTIME DICTIONARIES

    We're not a CS faculty but you could at least try...
  • 5
    Be merciful with the beginners
  • 1
    @theNox
    Be merciful and humane.
    Kill it quickly and painlessly.
  • 3
    @Ashkin lol
  • 1
  • 3
    In a Uni course we've had an exam for which we received 'starting code' and our task was to modify it to achieve additional functionality.

    On the first run, starting code crashed immediately with Segmentation fault. After 15mins of investigation (also by the teacher) we found something like this (only relevant parts):

    #define NODES 3
    Node nodes[NODES]
    ...
    for (int i = 0; i < 10; i++) {
    ...
    nodes[i].connect(nodes[i-8+2]);
    }

    And this was written by a teacher, not a student. He obviously did not even test-run once.
    I don't even..
Add Comment