{"id":13460,"date":"2015-04-13T11:00:00","date_gmt":"2015-04-13T15:00:00","guid":{"rendered":"https:\/\/simpleprogrammer.com\/?p=13460"},"modified":"2023-02-13T21:05:37","modified_gmt":"2023-02-14T02:05:37","slug":"why-comments-are-stupid-a-real-example","status":"publish","type":"post","link":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/","title":{"rendered":"Why Comments Are Stupid, a Real Example"},"content":{"rendered":"<p>Commenting on your code <a href=\"https:\/\/simpleprogrammer.com\/better-software-engineer-tips\/\">makes you a good Software Engineer<\/a>, right?<\/p>\n<p>Nothing seems to stir up <strong>religious debate<\/strong> more so than when I write a post or do a <a href=\"https:\/\/www.youtube.com\/watch?v=ErW6fEvulAc\" target=\"_blank\" rel=\"noopener\">YouTube video<\/a> that mentions how most of the time comments are not necessary and are actually more harmful than helpful.<\/p>\n<p>I first switched sides in this debate when I read the second edition of <a href=\"http:\/\/www.amazon.com\/gp\/product\/0735619670\/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0735619670&amp;linkCode=as2&amp;tag=makithecompsi-20&amp;linkId=XRVP7LFMXGGPFZPK\" target=\"_blank\" rel=\"noopener\">Code Complete<\/a>.<\/p>\n<p>In that book, Steve McConnell, made it abundantly clear to me that the reasons I was putting so many comments in my code was that:<\/p>\n<ul>\n<li><strong>I wasn&#8217;t naming things<\/strong> in a way that would make explanatory\u00a0comments unnecessary<\/li>\n<li>My methods and functions were far<strong> too large<\/strong> and thus needed extra explaining<\/li>\n<\/ul>\n<p>The way I wrote code drastically changed.<\/p>\n<p><strong>I had believed I was doing a good job, and being a dutiful programmer by writing comments to explain my code and make it easier for the next developer to understand them.<\/strong><\/p>\n<p>But, when I started applying what I learned in <a href=\"http:\/\/www.amazon.com\/gp\/product\/0735619670\/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0735619670&amp;linkCode=as2&amp;tag=makithecompsi-20&amp;linkId=XRVP7LFMXGGPFZPK\" target=\"_blank\" rel=\"noopener\">Code Complete<\/a>, and started writing code that was often more clear than the comments I was previously writing, I realized that I was doing a <strong>greater favor<\/strong> to any developers who would inherit my code than simply writing comments. <strong>I was keeping it simple &#8211; <a href=\"https:\/\/simpleprogrammer.com\/kiss-one-best-practice-to-rule-them-all\/\">obeying the KISS principle<\/a> &#8211; and making my code even more clear.<\/strong><\/p>\n<p>When I read Uncle Bob&#8217;s book, <a href=\"http:\/\/www.amazon.com\/gp\/product\/0132350882\/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0132350882&amp;linkCode=as2&amp;tag=makithecompsi-20&amp;linkId=OE6W2DLW3J5Z2TNZ\" target=\"_blank\" rel=\"noopener\">Clean Code<\/a>, my position further strengthened.<\/p>\n<p>Not only did Uncle Bob say we should avoid comments, he said\u2014and showed\u2014how comments, more often than not, indicated <strong>a failure to express intention in code.<\/strong><\/p>\n<p>Bob made me realize that I was still leaning too heavily on comments and that I needed to further improve my naming and strive to have my code communicate its intention without the need of outside aid.<\/p>\n<h2>Showing a real comment-removing example<\/h2>\n<p>Now, this was my own personal progression\u2014and I don&#8217;t expect everyone to have the same experience I did, or even to see things the same way\u2014but, I do feel <strong>there is still a large amount of ignorance that seems to spew forth whenever I mention that comments should generally be avoided<\/strong> in favor of more communicative code.<\/p>\n<p>For a while now, I&#8217;ve felt the burden of needing to back up what I am saying.<\/p>\n<p>It is one thing for me to extol the value of clear, communicative code, but it is another thing for me to show how clear\u2014or as Uncle Bob would put it &#8220;clean&#8221;\u2014code is far more understandable and maintainable than equally &#8220;good&#8221; code that is heavily commented.<\/p>\n<p>At first I was going to make up some code example to show you how this is the case.<\/p>\n<p>I was going to write some code that was not named very well and full of comments, and then show you how I could refactor that code to get rid of the comments and actually increase the clarity.<\/p>\n<p>But, I know from experience that is a trap.<\/p>\n<p>Too many people will cry foul and claim I have setup a &#8220;straw man&#8221; that didn&#8217;t represent real world code.<\/p>\n<p>Fortunately, I realized an excellent opportunity that is now open to me.<\/p>\n<h2>Refactoring some real code from the .NET framework<\/h2>\n<p>Since Microsoft decided to open source the entire .NET code base, I decided I would instead pick a real example of real code that is not bad, but just could be refactored to eliminate comments and still make the code just as clear\u2014and in my opinion clearer.<\/p>\n<p>I&#8217;ve just pulled out one method in this code, <em>SplitDirectoryFile,\u00a0<\/em>to illustrate my point.<\/p>\n<p>I don&#8217;t know who wrote this code, and I don&#8217;t even consider this code bad. I&#8217;m just using it as an example, so keep that in mind.<\/p>\n<p>I picked a fairly small method, so that it could be easily understood and fit into this blog post, but my general approach could be applied to much larger swatches of code.<\/p>\n<p>Let&#8217;s take a look at what the code looked like before I refactored it:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/simpleprogrammer-shared\/3684fb22d5090c7778f9a40e8f72dbeb.js\"><\/script><\/p>\n<p>Like I said before, this code isn&#8217;t bad.<\/p>\n<p>It&#8217;s pretty clear what it is doing.<\/p>\n<p>The comments even make sense.<\/p>\n<p>But,\u00a0could we eliminate all of these comments and actually make the code more understandable?<\/p>\n<p>Let&#8217;s start with the first comment. It seems innocent enough.<\/p>\n<blockquote><p>\/\/ assumes a validated full path<\/p><\/blockquote>\n<p>Is there was way we can communicate this in the code?<\/p>\n<h2>Replacing a comment with a better parameter name<\/h2>\n<p>What if we change the name of the variable from path to validatedFullPath?<\/p>\n<p><script src=\"https:\/\/gist.github.com\/simpleprogrammer-shared\/79577fe60687ec010a163a60054ffa78.js\"><\/script><\/p>\n<p>Not a huge difference\u2014almost trivial\u2014but, not only have we eliminated a comment, we&#8217;ve made it so someone calling this method can tell from the variable name that they are not just supposed to pass in a path, but a validated full path.<\/p>\n<p>Again, seems like a rather small change, but, I do believe it has made the code more clear.<\/p>\n<h2>A bit of a bigger change&#8230;<\/h2>\n<p>Moving on, we can take a look at the next comment:<\/p>\n<blockquote><p>\/\/ ignore a trailing slash<\/p><\/blockquote>\n<p>Now, there are a few ways we can handle this one.<\/p>\n<p>We can simply replace the comment with a method, so we have:<\/p>\n<blockquote><p>if (ShouldIgnoreTrailingSlash(length, rootLength, validatedFullPath)<\/p>\n<p>length&#8211;;<\/p><\/blockquote>\n<p>We could also create a simple boolean variable to replace the comment:<\/p>\n<blockquote><p>bool ShouldIgnoreTrailingSlash =\u00a0length &gt; rootLength &amp;&amp; EndsInDirectorySeparator(validatedFullPath);<\/p>\n<p>if(ShouldIgnoreTrailingSlash)<\/p>\n<p>length&#8211;;<\/p><\/blockquote>\n<p>Another, perhaps better possibility, would be to do something like this:<\/p>\n<blockquote><p>length = LengthWithoutTrailingSlash(length, rootLength, validatedFullPath);<\/p><\/blockquote>\n<p>But, I see an opportunity here to improve the overall readability and structure of the code and get rid of a comment.<\/p>\n<p>How about this refactor?<\/p>\n<p><script src=\"https:\/\/gist.github.com\/simpleprogrammer-shared\/b1dbc21b0454d7cf03f559200359bd1b.js\"><\/script><\/p>\n<p>It might seem like overkill here, but I think it makes a lot of sense to make this static method into an actual class.<\/p>\n<p>We can then very clearly communicate what the class is supposed to do and utilize the state of the class to simplify the code.<\/p>\n<p>Trying to cleanly remove comments led me to this refactoring of the method itself, because I found that the clearest way to express the intent was to encapsulate it.<\/p>\n<p>Now, you might not agree with this particular refactoring\u2014and that is fine\u2014but I&#8217;m sure you can still see how we can easily eliminate comments by expressing the intent in the code more clearly.<\/p>\n<h2>Now it gets easy<\/h2>\n<p>From here, it is trivial to get rid of the next comment:<\/p>\n<blockquote><p>\/\/ find the pivot index between end of string and root<\/p><\/blockquote>\n<p>All we have to do is change this into a method that says exactly what it does.<\/p>\n<p>https:\/\/gist.github.com\/simpleprogrammer-shared\/372ed51cc310d20ead580ac702be5942<\/p>\n<p>Again, I couldn&#8217;t resist changing the structure a bit as well.<\/p>\n<p>I moved the <em>Directory<\/em> and <em>File<\/em> to properties on the class instead of out parameters on the method.<\/p>\n<p>But, that isn&#8217;t as important as removing the comment and replacing it with a method that says the same thing while providing an abstraction on top of the logic.<\/p>\n<p>I also pulled out the idea of finding the pivot into a variable, so we could use that state, explicitly rather than counting on an early return. (Which wasn&#8217;t even explained by a comment.)<\/p>\n<p>Now the intent is much more clear. If we didn&#8217;t find a pivot we just want to return the trimmed directory.<\/p>\n<h2>The final refactor<\/h2>\n<p>That brings us to our final refactor:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/simpleprogrammer-shared\/52ada8cefb8d67fb7ef23c071fd9364f.js\"><\/script><\/p>\n<p>We&#8217;ve simply extracted the trimming of the directory into a method that says exactly what it does.<\/p>\n<p>Now, in my opinion, <strong>this code is much more clear, yet it has zero comments.<\/strong><\/p>\n<p>I can quickly look at this code and understand exactly what it is doing.<\/p>\n<p>The structure and naming of the variables and methods communicates in a much more precise and clear way what was being communicated in the comments of the original code.<\/p>\n<h2>Compare and contrast<\/h2>\n<p>Take a look at the original code versus this refactored code and see which one you think is easier to understand and maintain.<\/p>\n<p>Specifically compare the main method doing the work in each case:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/simpleprogrammer-shared\/6a1c3eefe6ba97145a7934ac7bcb008d.js\"><\/script><\/p>\n<p><script src=\"https:\/\/gist.github.com\/simpleprogrammer-shared\/11278937652cb75b04855ad18454aade.js\"><\/script><\/p>\n<p>Yes, I have changed the structure of the code to make it a class and I&#8217;ve replaced the out parameters with properties, but I could have achieved a similar result just getting rid of comments and replacing them with code and variable names that were more expressive. (Although, in this particular case, I&#8217;ll admit the out parameters makes things a bit more difficult.)<\/p>\n<h2>Code without comments is easier to maintain<\/h2>\n<p>Nevertheless, I&#8217;d make the argument that trying to write code in a way that the code expresses the intent rather than relying on comments causes you to structure code in a better way which results in more cohesive classes and a better overall structure.<\/p>\n<p>Whether you think I&#8217;ve made things better or not, one thing you can perhaps agree on is that I certainly haven&#8217;t made things worse.<\/p>\n<p>And if you can refactor from comments to no comments without losing clarity, it&#8217;s a net win in my book, because code gets updated, comments do not. (At least they often do not.)<\/p>\n<p>And remember, <strong>this was an example with some already decent code<\/strong>, where the comments weren&#8217;t very extraneous.<\/p>\n<p><strong>Most commented code I see doesn&#8217;t look like this at all.<\/strong><\/p>\n<p>In the code, the variables already had pretty good names and the comments talked about what the logic did, not how it did it.<\/p>\n<p>Most of the commented code I see uses comments as a crutch for code that is not very clear at all.<\/p>\n<p>So, in a sense, I picked a bad example.<\/p>\n<p>I didn&#8217;t cherry-pick some crappy code with bad comments and make it better by removing them\u2014that would have been easy.<\/p>\n<p>Anyway, I await the barrage of angry commentators (no pun intended.)<\/p>\n<p><strong>What do you think?<\/strong><\/p>\n<p>Have I convinced you at all?<\/p>\n<p>Can you at least see why writing code without comments isn&#8217;t lazy, but could actually be beneficial\u2014or at the very least a matter of taste?<\/p>\n<p><em>Here&#8217;s a practice that isn&#8217;t a stupid: marketing yourself. Your success won&#8217;t be defined solely on your technical skills &#8212; learn more in my course <a href=\"https:\/\/simpleprogrammer.com\/store\/products\/how-to-market-yourself\/\">&#8220;How to Market Yourself as a Software Developer&#8221;<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Commenting on your code makes you a good Software Engineer, right? Nothing seems to stir up religious debate more so than when I write a post or do a YouTube video that mentions how most of the time comments are not necessary and are actually more harmful than helpful. I first switched sides in this&#8230;<\/p>\n","protected":false},"author":2,"featured_media":13475,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[162232877],"tags":[],"class_list":["post-13460","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-better-software-engineer"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Why Comments Are Stupid, a Real Example - Simple Programmer<\/title>\n<meta name=\"description\" content=\"Are comments stupid? Well I think writing code without comments is not lazy. It can actually be beneficial.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Why Comments Are Stupid, a Real Example - Simple Programmer\" \/>\n<meta property=\"og:description\" content=\"Are comments stupid? Well I think writing code without comments is not lazy. It can actually be beneficial.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Simple Programmer\" \/>\n<meta property=\"article:published_time\" content=\"2015-04-13T15:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-14T02:05:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/simpleprogrammer.com\/wp-content\/uploads\/2015\/04\/stupid.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1089\" \/>\n\t<meta property=\"og:image:height\" content=\"598\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"John Sonmez\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"John Sonmez\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/\"},\"author\":{\"name\":\"John Sonmez\",\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/#\\\/schema\\\/person\\\/1abc70edfb189184827740310672de67\"},\"headline\":\"Why Comments Are Stupid, a Real Example\",\"datePublished\":\"2015-04-13T15:00:00+00:00\",\"dateModified\":\"2023-02-14T02:05:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/\"},\"wordCount\":1723,\"commentCount\":204,\"image\":{\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/simpleprogrammer.com\\\/wp-content\\\/uploads\\\/2015\\\/04\\\/stupid.png\",\"articleSection\":[\"Better Software Engineer\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/\",\"url\":\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/\",\"name\":\"Why Comments Are Stupid, a Real Example - Simple Programmer\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/simpleprogrammer.com\\\/wp-content\\\/uploads\\\/2015\\\/04\\\/stupid.png\",\"datePublished\":\"2015-04-13T15:00:00+00:00\",\"dateModified\":\"2023-02-14T02:05:37+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/#\\\/schema\\\/person\\\/1abc70edfb189184827740310672de67\"},\"description\":\"Are comments stupid? Well I think writing code without comments is not lazy. It can actually be beneficial.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/#primaryimage\",\"url\":\"https:\\\/\\\/simpleprogrammer.com\\\/wp-content\\\/uploads\\\/2015\\\/04\\\/stupid.png\",\"contentUrl\":\"https:\\\/\\\/simpleprogrammer.com\\\/wp-content\\\/uploads\\\/2015\\\/04\\\/stupid.png\",\"width\":1089,\"height\":598},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/why-comments-are-stupid-a-real-example\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/simpleprogrammer.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Why Comments Are Stupid, a Real Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/#website\",\"url\":\"https:\\\/\\\/simpleprogrammer.com\\\/\",\"name\":\"Simple Programmer\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/simpleprogrammer.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/simpleprogrammer.com\\\/#\\\/schema\\\/person\\\/1abc70edfb189184827740310672de67\",\"name\":\"John Sonmez\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc2f18dfa76e017566ce607de002d7abe4acfd5ec19a6db82c180b00867b8d94?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc2f18dfa76e017566ce607de002d7abe4acfd5ec19a6db82c180b00867b8d94?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc2f18dfa76e017566ce607de002d7abe4acfd5ec19a6db82c180b00867b8d94?s=96&d=mm&r=g\",\"caption\":\"John Sonmez\"},\"url\":\"https:\\\/\\\/simpleprogrammer.com\\\/author\\\/jsonmez\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Why Comments Are Stupid, a Real Example - Simple Programmer","description":"Are comments stupid? Well I think writing code without comments is not lazy. It can actually be beneficial.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/","og_locale":"en_US","og_type":"article","og_title":"Why Comments Are Stupid, a Real Example - Simple Programmer","og_description":"Are comments stupid? Well I think writing code without comments is not lazy. It can actually be beneficial.","og_url":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/","og_site_name":"Simple Programmer","article_published_time":"2015-04-13T15:00:00+00:00","article_modified_time":"2023-02-14T02:05:37+00:00","og_image":[{"width":1089,"height":598,"url":"https:\/\/simpleprogrammer.com\/wp-content\/uploads\/2015\/04\/stupid.png","type":"image\/png"}],"author":"John Sonmez","twitter_card":"summary_large_image","twitter_misc":{"Written by":"John Sonmez","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/#article","isPartOf":{"@id":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/"},"author":{"name":"John Sonmez","@id":"https:\/\/simpleprogrammer.com\/#\/schema\/person\/1abc70edfb189184827740310672de67"},"headline":"Why Comments Are Stupid, a Real Example","datePublished":"2015-04-13T15:00:00+00:00","dateModified":"2023-02-14T02:05:37+00:00","mainEntityOfPage":{"@id":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/"},"wordCount":1723,"commentCount":204,"image":{"@id":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/#primaryimage"},"thumbnailUrl":"https:\/\/simpleprogrammer.com\/wp-content\/uploads\/2015\/04\/stupid.png","articleSection":["Better Software Engineer"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/","url":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/","name":"Why Comments Are Stupid, a Real Example - Simple Programmer","isPartOf":{"@id":"https:\/\/simpleprogrammer.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/#primaryimage"},"image":{"@id":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/#primaryimage"},"thumbnailUrl":"https:\/\/simpleprogrammer.com\/wp-content\/uploads\/2015\/04\/stupid.png","datePublished":"2015-04-13T15:00:00+00:00","dateModified":"2023-02-14T02:05:37+00:00","author":{"@id":"https:\/\/simpleprogrammer.com\/#\/schema\/person\/1abc70edfb189184827740310672de67"},"description":"Are comments stupid? Well I think writing code without comments is not lazy. It can actually be beneficial.","breadcrumb":{"@id":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/#primaryimage","url":"https:\/\/simpleprogrammer.com\/wp-content\/uploads\/2015\/04\/stupid.png","contentUrl":"https:\/\/simpleprogrammer.com\/wp-content\/uploads\/2015\/04\/stupid.png","width":1089,"height":598},{"@type":"BreadcrumbList","@id":"https:\/\/simpleprogrammer.com\/why-comments-are-stupid-a-real-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/simpleprogrammer.com\/"},{"@type":"ListItem","position":2,"name":"Why Comments Are Stupid, a Real Example"}]},{"@type":"WebSite","@id":"https:\/\/simpleprogrammer.com\/#website","url":"https:\/\/simpleprogrammer.com\/","name":"Simple Programmer","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/simpleprogrammer.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/simpleprogrammer.com\/#\/schema\/person\/1abc70edfb189184827740310672de67","name":"John Sonmez","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dc2f18dfa76e017566ce607de002d7abe4acfd5ec19a6db82c180b00867b8d94?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dc2f18dfa76e017566ce607de002d7abe4acfd5ec19a6db82c180b00867b8d94?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dc2f18dfa76e017566ce607de002d7abe4acfd5ec19a6db82c180b00867b8d94?s=96&d=mm&r=g","caption":"John Sonmez"},"url":"https:\/\/simpleprogrammer.com\/author\/jsonmez\/"}]}},"_links":{"self":[{"href":"https:\/\/simpleprogrammer.com\/wp-json\/wp\/v2\/posts\/13460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/simpleprogrammer.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/simpleprogrammer.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/simpleprogrammer.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/simpleprogrammer.com\/wp-json\/wp\/v2\/comments?post=13460"}],"version-history":[{"count":0,"href":"https:\/\/simpleprogrammer.com\/wp-json\/wp\/v2\/posts\/13460\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/simpleprogrammer.com\/wp-json\/wp\/v2\/media\/13475"}],"wp:attachment":[{"href":"https:\/\/simpleprogrammer.com\/wp-json\/wp\/v2\/media?parent=13460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/simpleprogrammer.com\/wp-json\/wp\/v2\/categories?post=13460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/simpleprogrammer.com\/wp-json\/wp\/v2\/tags?post=13460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}