Slashdot Mirror


Programming Assignment Guide For CS Students

kennelbound writes "For those students just getting started in a Computer Science degree or a career in software development, this guide has been written to help you understand what NOT to do when coding a project. Those with a little more experience should still read it to get a good chuckle (and hopefully the mistakes stated within will not seem too familiar!)"

24 of 761 comments (clear)

  1. Additional Advice by nebaz · · Score: 5, Funny

    Use the minimum number of keywords in the language as possible. For example, all loops (for, while, do) can all be handled by a simple if and goto statement.

    --
    Rhymes that keep their secrets will unfold behind the clouds.There upon the rainbow is the answer to a neverending story
    1. Re:Additional Advice by nebaz · · Score: 5, Funny

      Oh, and also, always use labeled line numbers in multipes of 10. That way, if you need to insert lines later in the middle, you have some line numbers to use later.

      --
      Rhymes that keep their secrets will unfold behind the clouds.There upon the rainbow is the answer to a neverending story
    2. Re:Additional Advice by gcaseye6677 · · Score: 4, Funny

      In a pinch, you could just use GOTOs to branch your code farther down on the screen. But don't forget to include the GOTO to bring it back up, or your execution will be off. Ah, fond memories.

    3. Re:Additional Advice by YOU+LIKEWISE+FAIL+IT · · Score: 4, Funny

      No, no, no. Just patch the iterpreter or compiler to allow floating point line labels!

      --
      One god, one market, one truth, one consumer.
    4. Re:Additional Advice by MrBlue+VT · · Score: 3, Funny

      Not a bad idea. I like it! It does get tough because floating point numbers are often non-deterministic when you are dealing with computers.

      You might goto line 1.9999 when you meant to goto line 2. But hey, that's one of the prices you should be willing to pay for living on the bleeding edge of line numbering technology.

  2. Comment removed by account_deleted · · Score: 5, Funny

    Comment removed based on user account deletion

  3. Programming Mistake #1 by Rufus211 · · Score: 4, Funny

    Get your site linked from slashdot.

  4. One thing not to do by esac17 · · Score: 5, Funny

    I spent 2 days looking for a one character bug the other day, I hate these!

    if (condition);
    {
    myvar = 1;
    }

    The block was a lot bigger than myvar = 1, and my eyes kept skipping over the ; .. of course when I found it I felt stupid .. and well I should have :) hey wait, maybe I should have posted this Anonymously ...

  5. Guide to programming languages by prostoalex · · Score: 4, Funny
  6. Re:Advice from a fellow student by ErichTheWebGuy · · Score: 5, Funny

    I heartily disagree. Personally, being buzzed (but not hammered) provides my otherwise erratic brain the opportunity to focus intently.

    My motto: code drunk, debug sober

    --
    bash: rtfm: command not found
  7. your code should read like a novel by Simonetta · · Score: 5, Funny

    Yes, seriously...
    your code should read like a novel.

    After finishing the program, compiling, and debugging it, get out your microphone and one of those speech-to-text programs. Train it if you haven't done so already by reading the presented text for twenty minutes or so. Do the training twice: once when sober and properly intoxicated. (Myself, I grew up in the 1970's and consider alcoholic beverages déclassé, but everyone has their own favorite intoxicant).
    Get a picture of your favorite dreamboat celebrity and put it next to the screen. Load your source code on the editor and start the speech-to-text converter in the background.
    Take a deep breath and gaze adoringly in eyes of the person in the photo. Pretend that they are hopelessly infatuated with everything that you say and just love to hear you talk about your programming.
    Then start talking. Talk about your code. Start at the beginning. Talk about every line and what it does. How it works. How it fits. How totally cool it is. Just go on and on.
    When you're done, turn off the speech-to-text generator running in the background and save the hopefully rather large text file.
    Go back and cut and paste lines from the source file into the spoken description text file. (Use the speech-to-text engine to make this step go fast.)
    Hopefully you will now have about a half a page or more of rambling, but technically dense and accurate, speech text for every line of source code.
    This is the proper amount of commentary that every line of code needs.
    Put comment markers around your spoken text and lots of white space above and below the actual source lines.
    Your program is still good: it compiles and runs. But it now looks like a novel.

    This is good! The single line coding format that we all use is an obsolete product from the 1950's when a byte of computer RAM memory cost more than a good restaurant dinner. Those days are gone.
    Now you want to be able to read and understand the code quickly. It's far easier to glance and read through pages of rambling dictation describing the code than it is to try to understand 'normal' code with little pissant comments pasted randomly through it.
    You're a professional now. Anything that makes your job easier is good .
    If your CS professor disagrees, give them a copy of your speech-to-text software and a picture of Lindsey Lohan to place next to their screen and have them try it themselves.

  8. While we are on the subject by nwbvt · · Score: 4, Funny
    This has probably been posted on /. before (in fact I probably origionally found it here), but I can't resist posting this site:

    http://mindprod.com/unmain.html/

    My favorite:

    (On naming) # Bedazzling Names : Choose variable names with irrelevant emotional connotation. e.g.:
    marypoppins = ( superman + starship ) / god;

    This confuses the reader because they have difficulty disassociating the emotional connotations of the words from the logic they're trying to think about.
    --
    Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
  9. Another Tip by suwain_2 · · Score: 4, Funny

    Use clear, meaningful, variable names.

    I was playing with obfuscated Perl code, and got about 300 lines out. It was a script to go through my gaim logfiles, and generate stats for how much I talked to each person, how verbose they were, and so forth. It mostly just shelled various shell commands like wc, and my PIDs jumped by about 1,000 at the end (meaning that it was spawning about 1,000 processes from start-to-finish.) It wasn't well-written or anything, but it was kind of cool. And writing obfuscated, hack-job code is kind of fun. It ended up producing an HTML file.

    I finally decided that it'd be cool to have the program read its own source and output it to the HTML file. It was pretty easy, and, as with anything else done just for fun that isn't too challenging, I just assigned stuff to random variable names. $hats and $fog were the most commonly-used.

    I simply opened the source as $hats, and opened $fog for write, and then wrote $fog to $hats. No errors or anything!

    The output file was blank. So I went back to edit the source code. Umm, it's blank too. And, of course, I was just messing around, so I had no backups.

    Then one day it suddenly occured to me: I probably screwed up the variable names for the input and output, reading the blank output file and writing it over the program's source code.

    So, remember, kids, use meaningful variable names. Using $hats instead of $fog could be the end of your program.

    --
    ________________________________________________
    suwain_2 :: quality slashdot p
  10. Re:Advice from a fellow student by Mmmrky · · Score: 4, Funny

    I don't know, I've had some lengthy coding sessions inspired by alcohol. Usually wake up in the morning, stare at the code, realize it works, wonder how that is even possible, rename some stuff for clarity and redo the comments (drunk comments can be amusing, but not the kind of stuff you want to turn in).

  11. Re:Compiler Warnings by fireboy1919 · · Score: 4, Funny

    As a TA, I've often felt that students who ignore errors should should get points marked off for reasons they can't understand. After all, if they're going to make me do more work because they can't be bothered with simple comprehension, shouldn't I give them the same?

    Old comments:
    -1 Missing ";"
    -1 Changed case of variable; not recognized by the compiler.
    -2 Need a closing bracket "}"
    -3 Trying to write from an unassigned pointer.

    New comments:
    -1 Missing weasels exception error.
    -1 I just felt like taking a point off here.
    -2 For great justice
    -3 Disco Inferno at this point in the code.

    I never got up enough nerve to actually do it. Plus, I don't really want to risk any students suing the school.

    --
    Mod me down and I will become more powerful than you can possibly imagine!
  12. How about... by Bullseye_blam · · Score: 3, Funny

    When borrowing someone else's code to finish an assignment that totally stumps you... don't forget to change the variable names.

    -Bullseye

  13. Re:Cheating. by demonbug · · Score: 5, Funny
    OBVIOUS, but always missed. If you need to cheat, change majors.


    Yeah. Thats what the college of business is there for.

  14. Re:Most of the Prof's lecture notes are plagarized by Anonymous Coward · · Score: 3, Funny

    No, I am the true Mavaddat ! You can tell because i only write in italics, unlike my imposters

  15. Suggestion for Instructors by hussar · · Score: 3, Funny

    Don't provide solution sheets that contain code that will actually compile. After the frustration of working unsuccessfully for days (nights) to get her assigned programming project to compile and run correctly, what the student really wants is the character building exercise of debugging the instructor's solution to the exercise. When the students see that their instructor also has problems writing bug-free code, it will help to buttress their self-confidence.

    --

    Bureaucracy loves company.
  16. MAVADDAT SPEECHLESS!!! by Trepidity · · Score: 5, Funny

    mavaddat prefer people not post on slashdot using mavaddat name

    mavaddat work very long time downloading lecture notes for ungrateful kids paying only $700!

    mavaddat remind you 30" lcd monitor needing to purchase but cost much more!!!!

    MAVADDAT THE PROFESSOR!!!!! MAVADDAT BREAK HEAD WITH PLAGIARIZED CD!!!!!

  17. FOR and WHILE loops are for babies by nmb3000 · · Score: 3, Funny

    Why use boring old For and While loops when recursion is so much more fun? Next time you start typing 'for (i=0;'... ^H^H^H^H a few times and do it with a recursive function call instead. It's a lot more exciting, and just think of the fun somebody else is going to have in a few years when they try to update your code!

    That'll teach those dirty corporate &%*@!s. Lay me off will you? I hope the Indians like puzzles!

    Besides, nothing's cooler than that which has the rule "Just have faith it [recursion] will work."

    --
    "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
    /)
  18. Re:Slashdotted. Already. Here is article text. by cozziewozzie · · Score: 4, Funny

    You're a PhD student, and the only thing wrong you noticed with this heap of advice was the little part you quoted? Oh my. Good luck with your PhD! :-)

  19. True story by markov_chain · · Score: 3, Funny

    In an algorithms class (about 60 students) at my school there was a big challenging programming assignment mid-semester. The prof and the TAs caught a couple of people cheating, like 3 or so. Now this was a cool prof who didn't want to get kids kicked out of school so he decided to give them a second chance. On the final, there was a question worth 1 point stating "We found some cheating last month. If you did it, confess and you only fail the course. If you don't confess, we'll get you kicked out. Did you cheat? (1)"

    Half the class confessed.

    --
    Tsunami -- You can't bring a good wave down!
  20. Re:Slashdotted. Already. Here is article text. by JudicatorX · · Score: 3, Funny
    What kind of person would advise someone not to make questions because he/she will be intepreted as stupid?

    erm, The kind of person who is being satirical??

    But of course, I could be wrong since I'm not a PhD student....

    --
    "It is a good divine that follows his own instructions" - Portia, The Merchant of Venice