In my 10 years working as a software developer, I have oft been amazed by how poor a lot of code is (and I am certainly guilty of writing such code myself). At times it can be good for a laugh, but it makes me wonder: what differs in the development of critical systems (aviation, medical, military, automotive, etcetera) that yields such a higher standard of code quality?
If anyone has any experience working in these sectors, I'd love to hear about differences in methodologies, tools, procedures, schedules - anything you think contributes to higher quality code.