<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Konstantine Vashalomidze</title>
    <description>The latest articles on Forem by Konstantine Vashalomidze (@konstantine_vashalomidze_).</description>
    <link>https://forem.com/konstantine_vashalomidze_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2594550%2Fe5747ed9-e4fd-4215-b70c-adf2433f1dd8.jpg</url>
      <title>Forem: Konstantine Vashalomidze</title>
      <link>https://forem.com/konstantine_vashalomidze_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/konstantine_vashalomidze_"/>
    <language>en</language>
    <item>
      <title>Code Commenting Ethics: When Over-Documentation Hurts Development</title>
      <dc:creator>Konstantine Vashalomidze</dc:creator>
      <pubDate>Fri, 20 Dec 2024 09:11:17 +0000</pubDate>
      <link>https://forem.com/konstantine_vashalomidze_/code-commenting-ethics-when-over-documentation-hurts-development-5247</link>
      <guid>https://forem.com/konstantine_vashalomidze_/code-commenting-ethics-when-over-documentation-hurts-development-5247</guid>
      <description>&lt;h3&gt;
  
  
  &lt;em&gt;Striking the right balance between clarity and clutter in your codebase.&lt;/em&gt;
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;p&gt;Introduction&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.tothe-role-of-comments-in-code"&gt;The Role of Comments in Code&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Over-documentation: Issues and Consequences&lt;/p&gt;

&lt;p&gt;Striking the Right Balance&lt;/p&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;      &lt;em&gt;“Comment your code!”&lt;/em&gt; It’s advice every developer has heard at some point in their career. Good comments can be a lifesaver—offering clarity in legacy code, &lt;br&gt;
and providing context for collaborators. But what happens when this advice is taken too far? When comments are scattered everywhere, explaining the obvious, or worse, contradicting the code itself, they stop being helpful and start becoming a source of misunderstanding. &lt;/p&gt;

&lt;p&gt;      &lt;a href="https://doakio.com/blog/the-dark-side-of-over-documentation-why-less-can-be-more/" rel="noopener noreferrer"&gt;Over-documentation&lt;/a&gt; is a silent productivity killer. It slows down debugging, confuses new team members, and can even create a false sense of security in the codebase. In this article, we’ll determine the ethics of code commenting, how over-documentation hurts development, and the principles for striking the perfect balance between clarity and mess.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Role of Comments in Code
&lt;/h2&gt;

&lt;p&gt;      Programmers use comments not only to explain their code's purpose but also to simplify the understanding process of complex or challenging parts, provide context for decisions, and improve collaboration among team members. Comments act as a form of documentation, serving as a guide for future developers—or even the original author—to understand and modify the code efficiently. &lt;a href="https://blog.codacy.com/code-documentation" rel="noopener noreferrer"&gt;Documenting code&lt;/a&gt; and explaining it clearly is exactly why writing well-structured, readable code with meaningful comments is so important. Programs often outlive &lt;br&gt;
the expectations of their creators, sometimes persisting long after the original developer has moved on. Eventually, someone else will have to maintain the program, and they need to be able to understand how&lt;br&gt;
it works. &lt;/p&gt;

&lt;p&gt;      Remember, your audience isn’t the compiler; it’s other human beings. Just because your program compiles doesn’t mean it’s comprehensible to someone else. Write your code as if it’s meant to be read, understood, and improved by another person.&lt;/p&gt;
&lt;h2&gt;
  
  
  Over-documentation: Issues and Consequences
&lt;/h2&gt;

&lt;p&gt;      In today’s world, information is everywhere—whether it’s scrolling through endless posts on Reddit, diving into a company’s huge internal wiki, or managing emails with attachments. While having access to so much information might seem like an advantage, it often creates a problem: too much of it can make things harder, not easier. While documentation is important for keeping records, and organizational purposes, large documentation brings significant challenges. One such issue is the difficulty of shifting through huge amounts of information to find relevant and essential details. Such big data makes it more challenging to identify critical information and thus make decisions. Information overload overwhelms individuals, can led to &lt;a href="https://www.medicalnewstoday.com/articles/cognitive-fatigue" rel="noopener noreferrer"&gt;cognitive fatigue&lt;/a&gt;, stress and unproductivity. The mental exhaustion caused by this results in decreased efficency. Such large documentations also introduces confusion and misinformation. When many people add information in different places, it will be most likely that some of it may conflict or be incorrect. This makes it hard to know what's true and what isn't, which, once again, leads to making mistakes or bad decisions. And that's not all, over-documenting rises significant privacy concerns. In the digital era, the huge number of data and collection of information increase risk of teft, and unauthorized access to the resource. The more information documented and stored, the greater the vulnerability to security threats. &lt;/p&gt;
&lt;h2&gt;
  
  
  Striking the Right Balance
&lt;/h2&gt;

&lt;p&gt;      Finding the sweet spot between under- and over-documentation is very important for a productive and maintainable codebase. Too little documentation can leave developers guessing at the purpose of a piece of code, while doing it too much can drawn them in unnecessary details and significantly slow down the development process. To keep the balance one should understand how to use comments effectively, keeping them focused, concise and relevant.&lt;/p&gt;

&lt;p&gt;      The first principle is understanding that &lt;strong&gt;comments should explain the &lt;em&gt;why&lt;/em&gt; of the code, not the &lt;em&gt;what&lt;/em&gt;.&lt;/strong&gt; The code itself should be clear enough to determine &lt;em&gt;what&lt;/em&gt; it does. If the code is difficult to understand at first glance, the real issue might lie with the code itself, not the lack of comments. A good developer should aim to write code that speaks for itself, and comments should only be used to clarify decisions&lt;br&gt;
or assumptions that are not immediately obvious (like pre / post conditions for certain operations).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Correct: Explaining the reasoning behind a decision&lt;/span&gt;
&lt;span class="c1"&gt;// We use a hash map here to ensure constant time complexity lookups for larger datasets.&lt;/span&gt;
&lt;span class="nc"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;userCache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;HashMap&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// Incorrect: Commenting obvious behavior&lt;/span&gt;
&lt;span class="c1"&gt;// This loop iterates over the list of users&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;userList&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Some processing logic&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;      In first example, the comment has meaningful context for the choice of data structure based on performance consideration. The second example just restates what's already obvious. Thus first comment is correct one.&lt;/p&gt;

&lt;p&gt;      Sometimes it is better to just &lt;strong&gt;avoid comment at all.&lt;/strong&gt; Comments that simply restate the code, add noise to the codebase without offering any value. For instance, a comment stating &lt;em&gt;"increment the counter"&lt;/em&gt; on the line that increments a counter is unnecessary. This not only floats around into the codebase and wastes space but also gets the focus of the reader and thus wasting time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Redundant: Restating what the code does&lt;/span&gt;
&lt;span class="n"&gt;counter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;counter&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// Increment the counter by 1&lt;/span&gt;

&lt;span class="c1"&gt;// Better: Avoid unnecessary restatement&lt;/span&gt;
&lt;span class="n"&gt;counter&lt;/span&gt;&lt;span class="o"&gt;++;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;      The third one is to &lt;strong&gt;keep them concise and specific.&lt;/strong&gt; While comments should provide essential context, they should also be concise. Avoid long explanations that could overwhelm&lt;br&gt;
readers. A comment should be focused on explaining the reasoning behind a decision or clarifying complex logic, not on offering full history lesson. :D&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nl"&gt;Bad:&lt;/span&gt; &lt;span class="nc"&gt;Overly&lt;/span&gt; &lt;span class="n"&gt;detailed&lt;/span&gt; &lt;span class="n"&gt;explanation&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;simple&lt;/span&gt; &lt;span class="n"&gt;decision&lt;/span&gt;
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nc"&gt;The&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt; &lt;span class="n"&gt;we&lt;/span&gt; &lt;span class="n"&gt;are&lt;/span&gt; &lt;span class="n"&gt;using&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt; &lt;span class="n"&gt;here&lt;/span&gt; &lt;span class="n"&gt;instead&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;dictionary&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="n"&gt;that&lt;/span&gt;
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="n"&gt;dictionaries&lt;/span&gt; &lt;span class="n"&gt;have&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;higher&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;overhead&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;lists&lt;/span&gt; &lt;span class="n"&gt;are&lt;/span&gt; &lt;span class="n"&gt;much&lt;/span&gt; &lt;span class="n"&gt;more&lt;/span&gt; 
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="n"&gt;efficient&lt;/span&gt; &lt;span class="n"&gt;when&lt;/span&gt; &lt;span class="n"&gt;we&lt;/span&gt; &lt;span class="n"&gt;only&lt;/span&gt; &lt;span class="n"&gt;need&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt; &lt;span class="n"&gt;sequential&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="n"&gt;without&lt;/span&gt; &lt;span class="n"&gt;requiring&lt;/span&gt; 
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;based&lt;/span&gt; &lt;span class="n"&gt;lookups&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="nc"&gt;We&lt;/span&gt; &lt;span class="n"&gt;don&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="n"&gt;need&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;perform&lt;/span&gt; &lt;span class="n"&gt;lookups&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;so&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; 
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;better&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="no"&gt;A&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="n"&gt;simpler&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;more&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;efficient&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; 
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="n"&gt;faster&lt;/span&gt; &lt;span class="n"&gt;when&lt;/span&gt; &lt;span class="n"&gt;iterating&lt;/span&gt; &lt;span class="n"&gt;through&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;elements&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;  

&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nl"&gt;Good:&lt;/span&gt; &lt;span class="nc"&gt;Concise&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;relevant&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;  &lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nc"&gt;Use&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;efficiency&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;no&lt;/span&gt; &lt;span class="n"&gt;need&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;based&lt;/span&gt; &lt;span class="n"&gt;lookups&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;      Next one is to use comments to &lt;strong&gt;explain complex logic.&lt;/strong&gt; Sometimes and very often a code may involve complex non-intuitive logic. In this cases, comments are real gems. Explain the approach, assumptions or trade-offs. However be careful, if a piece of code is too complicated to explain in a comment, it's worth considering whether it can be simplified or &lt;a href="https://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672" rel="noopener noreferrer"&gt;refactored&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;
&lt;span class="c1"&gt;// Bad: No explanation of why this approach is used&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; 

&lt;span class="c1"&gt;// Good: Explaining the reasoning behind complex logic&lt;/span&gt;
&lt;span class="c1"&gt;// The division by 'c' here is intentionally done after multiplication to avoid &lt;/span&gt;
&lt;span class="c1"&gt;// rounding errors that can occur with floating-point division before multiplication.&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example in above the second comment adds value by explaining why the order of operations was chosen. This helps future developers who may encounter similar issues with floating point precsion.&lt;/p&gt;

&lt;p&gt;      One of the most commong problem with over-documentation is failling to &lt;strong&gt;update comments&lt;/strong&gt; as the code evolves. A comment that once made sense may no longer be accurate if the code changes. This can lead to misleading information and cause confusion. Always make sure that comments are updated whenever the corresponding code is modified.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nc"&gt;Old&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt; &lt;span class="n"&gt;reflecting&lt;/span&gt; &lt;span class="n"&gt;outdated&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt; &lt;span class="n"&gt;logic&lt;/span&gt;
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nc"&gt;This&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="n"&gt;adds&lt;/span&gt; &lt;span class="n"&gt;two&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="n"&gt;together&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;returns&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;span class="n"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_numbers&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;  &lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nc"&gt;The&lt;/span&gt; &lt;span class="n"&gt;operation&lt;/span&gt; &lt;span class="n"&gt;should&lt;/span&gt; &lt;span class="n"&gt;be&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;not&lt;/span&gt; &lt;span class="n"&gt;subtraction&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;

&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nc"&gt;Fixed&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nc"&gt;This&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="n"&gt;subtracts&lt;/span&gt; &lt;span class="n"&gt;two&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;returns&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;span class="n"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_numbers&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;      Last rule in our list is to &lt;strong&gt;use documentation for high-level concepts.&lt;/strong&gt; Inline comments are as important as high-level documentations. High-level documentations should be &lt;br&gt;
used to explain overall design decisions, the architecture, behavior and pre / post conditions. This can be done in documentation files, class-level comments, or docstrings, depending on the language.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;
&lt;span class="cm"&gt;/**
 * Class that handles user authentication.
 * This class verifies user credentials and manages session tokens.
 */&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AuthService&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;      Striking the balance between over-and under-documenation is important for a well-maintained and efficient codbase. Over-documenation can lead to confusion, inneficiency and &lt;br&gt;
unnecessary cognitive load, while too little documentation can make codebase difficult to maintain and understand. So dear fellow developers please spend some time while making documentation this will change &lt;br&gt;
life thwards good! &lt;/p&gt;

&lt;p&gt;Author Konstantine Vashalomidze&lt;br&gt;
19.12.2024&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>cleancode</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
