← Back to context

Comment by saghm

9 years ago

> How many times I've skipped checking something because... There's no way it could be that!

I TA'd a course in college that (among other things) was the first introduction that CS students at my school had to C programming. Since most students had no prior experience with anything besides Java (and a little OCaml, because one of the intro courses was half Java and half OCaml), they often would be at a complete loss of how to debug errors with pointers, string handling, etc. Whenever I tried to help students debug something in office hours, they would try to steer me away from looking in certain parts of their code because they "knew that was correct", and quite often the error would be in one of those parts of the code. The lesson I tried to teach them was that if you thought you wrote all your code correctly but it still doesn't work correctly, then you must have been wrong about something, so you have to be ready to challenge your assumptions about what's working and what isn't.

Occasionally, the fault isn't even really in the code! I remember some years ago spending a very long time debugging some code for my school coursework with my teacher. The code looked perfectly fine, but it didn't work. The usual process of commenting parts out didn't work. We finally realised the code editor was inserting a byte order mark into the file which caused the problem.