Yup. Messed that one up totally.
You are so busy being sarcastic you don't examine what I'm saying.
Suppose you are dealing with code that is greater then 4 years old that has had several hands involved in it. You are asked to add some functionality to the program.
You need to find out where in the code that functionality should go, and add it in an appropriate place.
So are you going to understand what the program is doing by reading the comments or the code? If you've had any experience you will of course read the code. The code has been tested and works, while the comments are only what some programmer thought he was doing.
What I'm saying is you should write your code so that comments are superfluous, and if the comments are superfluous then why are you writing them. The reason you would write them is when the code doesn't explain what you are trying to do.
Or you could just rant and rave that the comments don't make sense and therefore you can't change the program.
You've got no idea what you are talking about.
Actually I agree with the professor. Overtime code will change, and comments rarely are kept up with the same level as the code. I therefore don't read comments as often as just looking at the code. (Hence the saying "comments lie")
I also rarely comment as the code is created with enough information that it has the commenting built in.
The only time I comment is when something is happening that is not obvious from the code, or which explains the background thinking behind doing something a certain way. Basically just notes to myself to remind me (or the next guy) what thoughts went into it.
And of course I mistyped the code.
int n;
printf("we have %d pair%s of shoe%s",n, (n!=1) ? : "s" : "", (n!=1) ? "es" : "");
I like to use ternary conditions in my code where strings output based on a condional
for example
int n;
printf("we have %d pair%s of shoe%s",n,n ? : "s" : "",? "es" : "");
If you aren't used to it it is confusing, but if you are it saves a ton of code.
Is it considered a clever one liner?
How about
while(1)
{
}
My code is usually very terse, which helps me maintain it because dense code requires less reading to understand. (IMHO)
I tried this once, but I hated being on a leash so much that I quickly found another job. It just wasn't worth my sanity.
Agreed. SOOO addictive. I'm having Crack-attack dreams.
I guess my kids were lucky, they had touch typing in grade 3. They had keyboards that were a bit smaller to accommodate smaller hands.
The teacher taught them to not look at their hands while typing.
I took typing in grade 9, and it was the most practical course I ever took.
My kids are done high school and they all type faster then me, and I go around 70 wpm.
I think boredom is a useful tool, to encourage young minds to think for themselves. Also to encourage young minds to not get boring jobs. If you've never experienced boredom you won't understand how tedious it is.
With this in mind, I think unschooling should be taught in schools. Students should sit at their desks for many hours a day with a teacher droning on and on about some book to be examined in microscopic detail until nothing of interest remains.
Oh wait.... that happens now.
BASIC is the Computer Science equivalent of `Scientific Creationism'.