Didn't Dijkstra suggest in "A Discipline of Programming" that each program should come with a mathematical proof of it's correctness so that it was by definition bug free? Of course, one would need a meta proof (or at least publication in a peer reviewed journal) to prove the correctness of the proof.
One of my standard interview questions is, "What is your approach to debugging?" I'm expecting something like, "First I reproduce the problem in a test environment, and then I run the debugger or add debugging code to identify the exact place where the error is introduced." Extra points if the person says, "First I log it in a bug tracking system." No points at all if the candidates claims to write bug free code.