{"id":26353,"date":"2024-03-28T16:45:35","date_gmt":"2024-03-28T21:45:35","guid":{"rendered":"http:\/\/blog.kenperlin.com\/?p=26353"},"modified":"2024-03-28T16:45:35","modified_gmt":"2024-03-28T21:45:35","slug":"debugging-with-comments","status":"publish","type":"post","link":"http:\/\/blog.kenperlin.com\/?p=26353","title":{"rendered":"Debugging with comments"},"content":{"rendered":"<p>Programmers sometimes think of commenting their code as a chore. &#8220;Can&#8217;t people just read my code,&#8221; they ask, &#8220;and see what I am doing?&#8221;<\/p>\n<p>But it&#8217;s not that simple. Not only is commenting good for communicating with others, it is also an excellent way to communicate with yourself.<\/p>\n<p>When you write out, in plain English, exactly what you are doing, you understand it better. Doing a good job of explaining something is one of the best ways of understanding it yourself.<\/p>\n<p>Also, you might find that when you go through the effort to do this, you uncover flaws in your own code or its underlying algorithm. More than once, I have started to comment my code only to realize that I could now see an error or unhandled case in the program itself.<\/p>\n<p>In short, commenting your own code is one of the best ways to debug it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Programmers sometimes think of commenting their code as a chore. &#8220;Can&#8217;t people just read my code,&#8221; they ask, &#8220;and see what I am doing?&#8221; But it&#8217;s not that simple. Not only is commenting good for communicating with others, it is also an excellent way to communicate with yourself. When you write out, in plain English, &hellip; <a href=\"http:\/\/blog.kenperlin.com\/?p=26353\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Debugging with comments&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/26353"}],"collection":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=26353"}],"version-history":[{"count":1,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/26353\/revisions"}],"predecessor-version":[{"id":26354,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/26353\/revisions\/26354"}],"wp:attachment":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26353"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}