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!)"

47 of 761 comments (clear)

  1. rule 1 by Anubis350 · · Score: 2, Funny

    rule one: do not post vulnerable servers on slashdot without a mirror

    --
    "goodbye and hello, as always" ~Prince Corwin, from Zelazny's Amber series
  2. 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 dtfinch · · Score: 2, Funny

      Declaring local variables will just add unnecessary typing. Just put it all in globals for maximum code reuse.

      And classes, they don't add anything you can't get with functions. All they do is restrict you.

      But why even use functions? All that happens is you try to make one piece of code serve multiple uses when you'll be better off tailoring the code to each instance where it's needed.

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

    4. Re:Additional Advice by kngthdn · · Score: 2, Funny

      Thanks! Now I can write my first computer program... 10 DIM WITTED

    5. 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.
    6. 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.

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

    Comment removed based on user account deletion

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

    Get your site linked from slashdot.

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

  6. Re:Compiler Warnings by Anonymous Coward · · Score: 1, Funny

    It's satire dude...

  7. Re:Most of the Prof's lecture notes are plagarized by ansleybean · · Score: 2, Funny

    haha, i had a prof that did that. although i have to say that original powerpoint slides aren't any more interesting than plagarized ones.

  8. Re:Slashdotted. Already. Here is article text. by roman_mir · · Score: 2, Funny

    And what about that bloke in Operation Swordfish? Would he have cracked the Pentagon password if one of Travoltas hitmen hadnt been pointing a pistol at his head while another Travolta hitwoman was trying to distract him? - I think it should be mandatory for every CS class to have their own hitmen who would point guns at the students' heads while some hitwomen would try to distruct them. Then everyone would be like those hackers in movies, hacking away those 128bit encryption algorythms in just under 60 seconds.

  9. Guide to programming languages by prostoalex · · Score: 4, Funny
  10. Re:Ye old Slashdot Effect by ral315 · · Score: 1, Funny

    From 6:00p-12:43a EST, it's taken 2407 hits- 48140% more traffic than it did the previous day.

  11. 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
  12. Re:For the guys... by vranash · · Score: 2, Funny

    Yeah, I mean I once had a girl in a programming class say she'd do *ANYTHING* to pass the class, so I had her buy me dinner in exchange for helping her study, then never saw her again!

    Sad part is this is all true.

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

    1. Re:your code should read like a novel by Anonymous Coward · · Score: 1, Funny

      Just use COBOL and this will happen automatically.

    2. Re:your code should read like a novel by Anonymous Coward · · Score: 1, Funny

      You need to comment on how the heck you have two variables on the left side of the =.

      most likely you're using a custom language, which will be unfamiliar to the reader, and therefore will require a novel to explain it!

  14. 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.
    1. Re:While we are on the subject by Anonymous Coward · · Score: 1, Funny

      I love that essay. Unfortunately almost all of the habbits described apply to the program I was hired to maintain...

  15. 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
  16. 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).

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

    Dude , U just made a F in my course. U should at least wait till u get the grades before making stupid (though true) /. posts abt me Mavaddat

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

    Although I agree the above post, I must point out that it wasn't written by me as I am the real Mavaddat.

  19. Funny incident by Anonymous Coward · · Score: 1, Funny

    There was one very funny incident in my school, a long time ago. This student copied the code from this other geek. Unfortunately the original writer put his name all over the place, like (c) Bill Gates, etc. So, the student had to do a manual find and replace (because he didn't know how to work vi either).

    As we, in the software community know, manual find and replaces are prone to errors. So, he submitted the code to his professor, who approved it and executed it.

    Unfortunately, the output started with something like:
    THIS PROGRAM IS WRITTEN BY BILL GATES

    Luckily, the professor did not see the message printed, and gave him a high score.

  20. Re:Cheating. by Anonymous Coward · · Score: 0, Funny

    Allow me to be completely honest. I was such a lazy slacker in school that I almost NEVER bothered putting in the thought or brainpower into writing an assignment. Instead, what I usually did was find a way to hack into the time sharing system, bypass file access privileges, and grab other students' finished code. I would then compile them into executables, and tested them to ensure they worked. I would keep discarding until I found one with the least possible number of run-time bugs. I would then use a disassembler and generate an assembly language version of the executable. Finally, using the assembly language version as a reference, I would begin coding in the appropriate high level language.

    Nobody ever figured out my method of cheating. But I got great grades and I sure didn't have to waste time thinking of how to write those silly assignments!

  21. 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!
  22. 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

  23. Re:For the guys... by Wescotte · · Score: 2, Funny

    Yeah, I mean I once had a girl in a programming class say she'd do *ANYTHING* to pass the class, so I had her buy me dinner in exchange for helping her study, then never saw her again!

    A woman says she'll do anything for your help and the best you can think of is dinner? She said ANYTHING! Are you a man or what!?! Think bigger my friend!

    Have her buy you two dinners!

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

  25. Re:My advice for young programmers by Anonymous Coward · · Score: 1, Funny

    What kind of fucked up language starts arrays at zero?

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

  27. 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.
  28. 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!!!!!

  29. 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
    /)
  30. this copy thing seems... by jlemmerer · · Score: 2, Funny

    ... to be the microsoft way. did you copy it from them?

    --
    ".Sig Stealer" was here
  31. They forgot by coolgeek · · Score: 2, Funny

    Don't waste valuable coding time checking for various error conditions and handling them. Most of the time the return code from various functions is just fine. If it isn't, then there is something really wrong with the system, or the user is a complete jackass who deserves to spend hours scratching their head trying to figure out why your program doesn't work.

    Time wasted coding error handlers is better spent implementing more features in your program. You can always wait for version 2 to implement real error handling where it is needed based on user reports.

    --

    cat /dev/null >sig
  32. 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! :-)

  33. Re:Advice from a fellow student by Anonymous Coward · · Score: 2, Funny

    Yeah, because, as we all know, weed causes you to totally blackout for HOURS on end with no recollection of the evening *rolls eyes*

    BS.

  34. 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!
  35. 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
  36. Re:Advice from a fellow student by Anonymous Coward · · Score: 1, Funny

    What about doing a hypercard implementation of Daleks while on LSD? Does that count?

  37. Re:Advice from a fellow student by Anonymous Coward · · Score: 1, Funny

    Actually, really good bud can do that to girls. I've seen a couple get all loopy and not know where they are after smoking a couple of bowls.

    Uh dude... they're just pretending. They're acting like that because they want you to fuck them.

  38. Re:Finer points of Spanish-English translation by Anonymous Coward · · Score: 1, Funny

    So he's aware of what celsius is, and pays enough attention to notice the nationality of the author, and he's ethnocentric? NO, I charge that you, sir, are secretly a fundamentalist anti-Fahrenheitist! Yes you and your "rest of the entire planet" brainwashed lackeys will stop at nothing to eradicate the last traces of good ole F. Your attempts to whitewash history will fail! Don't turn your back on the tradition of your forefathers only to sell out to some cheap, glamorous, modern machine. Don't join the masses simply because they are numerous. Oppose the cultural imperialism of Celsius!