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!)"
rule one: do not post vulnerable servers on slashdot without a mirror
"goodbye and hello, as always" ~Prince Corwin, from Zelazny's Amber series
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
Comment removed based on user account deletion
Get your site linked from slashdot.
I spent 2 days looking for a one character bug the other day, I hate these!
.. of course when I found it I felt stupid .. and well I should have :) hey wait, maybe I should have posted this Anonymously ...
if (condition);
{
myvar = 1;
}
The block was a lot bigger than myvar = 1, and my eyes kept skipping over the ;
It's satire dude...
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.
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.
You can't handle the truth.
Quick guide to programming languages
From 6:00p-12:43a EST, it's taken 2407 hits- 48140% more traffic than it did the previous day.
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
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.
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.
http://mindprod.com/unmain.html/
My favorite:
Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
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
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).
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
Although I agree the above post, I must point out that it wasn't written by me as I am the real Mavaddat.
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.
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!
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!
When borrowing someone else's code to finish an assignment that totally stumps you... don't forget to change the variable names.
-Bullseye
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!
Yeah. Thats what the college of business is there for.
What kind of fucked up language starts arrays at zero?
No, I am the true Mavaddat ! You can tell because i only write in italics, unlike my imposters
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.
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!!!!!
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
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
/)
... to be the microsoft way. did you copy it from them?
".Sig Stealer" was here
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
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! :-)
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.
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!
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
What about doing a hypercard implementation of Daleks while on LSD? Does that count?
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.
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!