{"id":8548,"date":"2018-02-12T11:06:29","date_gmt":"2018-02-12T10:06:29","guid":{"rendered":"https:\/\/blogs.mentor.com\/colinwalls\/?p=8548"},"modified":"2026-03-26T16:53:42","modified_gmt":"2026-03-26T20:53:42","slug":"my-code-is-bug-free","status":"publish","type":"post","link":"https:\/\/blogs.sw.siemens.com\/embedded-software\/2018\/02\/12\/my-code-is-bug-free\/","title":{"rendered":"My code is bug-free!"},"content":{"rendered":"<p>There is an old joke saying: \u201cTo err is human, but for a real ****-up, get a computer.\u201d This chimes with many people\u2019s experience of computers [and embedded systems!], because things do go wrong. Often. The irony is that almost all problems with computer systems, that are encountered on an everyday basis, are rooted in software. Who designs, writes and tests software? Human beings, that is who \u2026<!--more--><\/p>\n<p>Software developers spend quite a small proportion of their time designing and writing new code. Much more time is spent maintaining\/updating existing code and debugging the code they have written. A favorite quote of mine came from my friend Jack Ganssle: \u201cLearn to love your debugger; you are going to spend a lot of time with it.\u201d It was quite a few years ago that he said this, but it is just as true now as it was then.<\/p>\n<p>I have a theory about why code has so many bugs. You might ask where they come from. My answer is that they are caused by modern debuggers! My thinking is as follows. Way back in the dawn of time, programmers would code using a pencil and paper. They would carefully write out their code, taking great care with the syntax. They would then \u201cdry run\u201d it on paper to verify the logic. Only then would they initiate the time-consuming process or entering the code, building and executing it. They might still have bugs, but typically they would be small and\/or subtle.<\/p>\n<p>Nowadays, developers type the code straight into the machine, use the compiler to sort out the syntax [which is unsafe as it does not know whether you meant = or ==, for example] and then the debugger to sort out execution time problems &#8211; bugs. These bugs include the logical errors that should have been spotted during a verification phase that [typically] no longer takes place. The fact that the debugger is so easily available means that developers rely on it instead of using their brains.<\/p>\n<p>So, how can we improve matters? I am not going to suggest going back to coding on paper [but not reject the idea either!]. I think we need to start with terminology and responsibility.<\/p>\n<p>I generally like to say things in a straightforward way. To me, plain, clear communication is all about getting to the point. As a result, I do not like euphemisms. For example, if someone has died, however sad that may be, just say so. Do not tell me that they have \u201cpassed away\u201d or \u201cpassed on\u201d or the ridiculous \u201cpassed\u201d. The relevance of this attitude here is that a \u201cbug\u201d is just a euphemism for \u201cerror\u201d. Or, more specifically, \u201cprogrammer error.\u201d<\/p>\n<p>On a similar theme, Jack Ganssle [he is back again!] addressed this in a <a href=\"https:\/\/www.eeweb.com\/profile\/jack-ganssle\/articles\/ive-never-had-a-bug-in-my-code\" target=\"_blank\" rel=\"noopener noreferrer\">recent article<\/a>. He suggested that the word \u201cbug\u201d is essentially a way of shirking responsibility. Bugs sound like something that flew in through the window and got into your code when you were looking the other way. They sound like they have an independent existence that is quite separate from the efforts of the developer.<\/p>\n<p>It is time to change! Stop talking about abstract bugs and refer to them as errors. \u201cWhat are you doing?\u201d \u201cI am fixing some errors that I made in my code.\u201d That sounds better; an engineer taking ownership of the problem. I can imagine some managers being shocked to hear that their developers are making errors and many developers not wanting to admit it. But it is time to get real and come out.<\/p>\n<p>My name is Colin and I am an error-prone programmer &#8230;<\/p>\n<p><a href=\"http:\/\/www.linkedin.com\/in\/colinwalls\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6579\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/linkedin.png\" alt=\"\" width=\"40\" height=\"40\" \/><\/a><a href=\"https:\/\/twitter.com\/colin_walls\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6583\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/twitter.png\" alt=\"\" width=\"40\" height=\"40\" \/><\/a><a href=\"https:\/\/www.facebook.com\/colinwalls.author\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6591\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/facebook.png\" alt=\"\" width=\"40\" height=\"40\" \/><\/a><a href=\"https:\/\/plus.google.com\/116301748426290440139\/posts?hl=en%3Fhl=en\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6587\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/google.png\" alt=\"\" width=\"40\" height=\"40\" \/><\/a><a href=\"http:\/\/www.slideshare.net\/ColinWalls\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6595\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/slideshare.jpg\" alt=\"\" width=\"41\" height=\"41\" \/><\/a><a href=\"http:\/\/blogs.mentor.com\/colinwalls\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6599\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/wordpress.jpg\" alt=\"\" width=\"44\" height=\"44\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is an old joke saying: \u201cTo err is human, but for a real ****-up, get a computer.\u201d This chimes&#8230;<\/p>\n","protected":false},"author":71677,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[1],"tags":[313,424,339,300,478],"industry":[],"product":[],"coauthors":[],"class_list":["post-8548","post","type-post","status-publish","format-standard","hentry","category-news","tag-c","tag-debugging","tag-development-tools","tag-embedded-software","tag-sourcery-codebench"],"_links":{"self":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/8548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/users\/71677"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/comments?post=8548"}],"version-history":[{"count":1,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/8548\/revisions"}],"predecessor-version":[{"id":10658,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/8548\/revisions\/10658"}],"wp:attachment":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/media?parent=8548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/categories?post=8548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/tags?post=8548"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/industry?post=8548"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/product?post=8548"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/coauthors?post=8548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}