<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>java code comments Archives - Francesco Lelli %</title> <atom:link href="https://francescolelli.info/tag/java-code-comments/feed/" rel="self" type="application/rss+xml" /><link>https://francescolelli.info/tag/java-code-comments/</link> <description>Information Management, Computer Science,  Economics, Finance and more</description> <lastBuildDate>Sun, 24 Nov 2019 11:04:39 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod> hourly </sy:updatePeriod> <sy:updateFrequency> 1 </sy:updateFrequency> <generator>https://wordpress.org/?v=6.8.5</generator><image> <url>https://francescolelli.info/wp-content/uploads/2018/11/cropped-InstrumentElement-32x32.jpg</url><title>java code comments Archives - Francesco Lelli %</title><link>https://francescolelli.info/tag/java-code-comments/</link> <width>32</width> <height>32</height> </image> <site
xmlns="com-wordpress:feed-additions:1">156264324</site> <item><title>Best practices on how to write comments in your code</title><link>https://francescolelli.info/programming/best-practices-on-how-to-write-comments-in-your-code/</link> <comments>https://francescolelli.info/programming/best-practices-on-how-to-write-comments-in-your-code/#respond</comments> <dc:creator><![CDATA[Francesco Lelli]]></dc:creator> <pubDate>Tue, 13 Aug 2019 13:48:39 +0000</pubDate> <category><![CDATA[Java]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[code best practices]]></category> <category><![CDATA[comments]]></category> <category><![CDATA[comments in code]]></category> <category><![CDATA[java code comments]]></category> <category><![CDATA[python code comments]]></category> <guid
isPermaLink="false">https://francescolelli.info/?p=1640</guid><description><![CDATA[<p>Should I really care and learn about how to write comments? Really!? I do not have time for these things. How many times did you thought something like that? Well you are not alone. However: Have you ever tried to solve a very important problem doing some programming but found stacked because you can not [&#8230;]</p><p>The post <a
href="https://francescolelli.info/programming/best-practices-on-how-to-write-comments-in-your-code/">Best practices on how to write comments in your code</a> appeared first on <a
href="https://francescolelli.info">Francesco Lelli</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Should I really care and learn about how to write comments? Really!? I do not have time for these things. How many times did you thought something like that? Well you are not alone. However:</p><p><em>Have you ever tried to solve a very important problem doing some programming but found stacked because you can not understand the code that you wrote the week before? </em></p><div
class="wp-block-image"><figure
class="alignright is-resized"><img
decoding="async" data-attachment-id="1644" data-permalink="https://francescolelli.info/programming/best-practices-on-how-to-write-comments-in-your-code/attachment/commentsinyourcode/" data-orig-file="https://francescolelli.info/wp-content/uploads/2019/08/CommentsInYourCode.png" data-orig-size="1101,395" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="CommentsInYourCode" data-image-description="" data-image-caption="&lt;p&gt;how to write comments&lt;/p&gt;
" data-medium-file="https://francescolelli.info/wp-content/uploads/2019/08/CommentsInYourCode-300x108.png" data-large-file="https://francescolelli.info/wp-content/uploads/2019/08/CommentsInYourCode-1024x367.png" src="https://i1.wp.com/francescolelli.info/wp-content/uploads/2019/08/CommentsInYourCode.png?fit=790%2C283&amp;ssl=1" alt="how to write comments" class="wp-image-1644" width="240" height="85" srcset="https://francescolelli.info/wp-content/uploads/2019/08/CommentsInYourCode.png 1101w, https://francescolelli.info/wp-content/uploads/2019/08/CommentsInYourCode-300x108.png 300w, https://francescolelli.info/wp-content/uploads/2019/08/CommentsInYourCode-768x276.png 768w, https://francescolelli.info/wp-content/uploads/2019/08/CommentsInYourCode-1024x367.png 1024w, https://francescolelli.info/wp-content/uploads/2019/08/CommentsInYourCode-600x215.png 600w" sizes="(max-width: 240px) 100vw, 240px" /><figcaption>how to write comments</figcaption></figure></div><p>If you are writing code this is not happen yet in your life, it is doom to happen soon. If you plan to implement something as part of your thesis. I can guarantee you that it will happen!</p><p>The problem of how to write comments into the code is fairly common and well understood in business. Companies, in the attempt to mitigate this phenomena, create guidelines on how to comment the developed code in order to make it understandable by different employees.</p><p>Good comment practices can be applied in all possible programming languages. The goal is not to improve the speed or the consumption of memory. It is more related to focusing on let other humans understand what has the program does and why. By the way, that &#8220;other human&#8221; most of the time is your future self!</p><h3 class="wp-block-heading">1: Write comments when you are writing the code</h3><p>You should considering writing comments when you are writing the code itself. Otherwise, you will probably forget half of them and will spend twice the time in doing this task. In general, you will be the primary user of these comments as often will have to read again the code in order to modify its functionalities.</p><h3 class="wp-block-heading">2: Every class a and functions should start with a description</h3><p>A code should start with a general description of the program containing:</p><ul
class="wp-block-list"><li>The problem(s) that the code solves</li><li>The data-structure(s) used in the code.</li><li>What algorithms and techniques, are used in a particular piece of the program</li></ul><p>Every functions should have a description of the general idea and the input and output should be explained</p><h3 class="wp-block-heading">3: What you write matter</h3><p>Know how to write a comment is more then just writing comments for the sick of writing comments . Consider the following when deciding what to write:</p><ul
class="wp-block-list"><li>Do not comment the obvious</li><li>Do not comment what the code is doing</li><li>Comment why you are doing it.</li></ul><p>Below you can find a couple of videos that share some insight on how to comment. This first share a few best practices using Eclipse and Java as a framework of reference. The author also makes the a good point when he says that good code should be self-explanatory and shows a concrete example of that. Similar points can be made with Python code as well.</p><figure
class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div
class="wp-block-embed__wrapper"> <iframe
title="Is it Bad to Comment Code? Easy Self-Documenting Practices" width="800" height="450" src="https://www.youtube.com/embed/2-KBQsTo8AY?feature=oembed&#038;enablejsapi=1&#038;origin=https://francescolelli.info" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div><figcaption><br></figcaption></figure><p>This video explain another set of best practices when commenting the code. However instead of focusing on Java use Python as reference language.</p><figure
class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div
class="wp-block-embed__wrapper"> <iframe
title="Comments in Python: Best Practices" width="800" height="450" src="https://www.youtube.com/embed/0NO3MJkxm2g?feature=oembed&#038;enablejsapi=1&#038;origin=https://francescolelli.info" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div></figure><p>Independently of the language that you are using both these videos can help you in understanding common best practices that you should use in your code, Java, Python or anything else.</p><p>Other useful resources of understanding the basic of programming includes:</p><ul
class="wp-block-list"><li><a
href="https://francescolelli.info/python/integrated-development-environment-ide-why-you-need-one/">Why you need an IDE</a></li><li><a
href="https://francescolelli.info/tutorial/object-oriented-programming-a-curated-set-of-resources/">The Basic of Object Oriented Programming (OOP)</a></li></ul><p>And if you believe that you are a super talented programmer this article should put things in perspective:</p><ul
class="wp-block-list"><li><a
href="https://francescolelli.info/programming/how-to-design-a-good-api-advanced-object-oriented-programming/">How to design a good API </a></li></ul><hr
/><p><em> Best practices on how to #write #comments in your #code. #programminglife of #SoftwareEngineer . #java and #python  examples </em><br
/><a
href='https://twitter.com/intent/tweet?url=https%3A%2F%2Ffrancescolelli.info%2Fprogramming%2Fbest-practices-on-how-to-write-comments-in-your-code%2F&#038;text=%20Best%20practices%20on%20how%20to%20%23write%20%23comments%20in%20your%20%23code.%20%23programminglife%20of%20%23SoftwareEngineer%20.%20%23java%20and%20%23python%20%20examples%20%20%20&#038;related' target='_blank' rel="noopener noreferrer" >Share on X</a><br
/><hr
/><p></p><p>The post <a
href="https://francescolelli.info/programming/best-practices-on-how-to-write-comments-in-your-code/">Best practices on how to write comments in your code</a> appeared first on <a
href="https://francescolelli.info">Francesco Lelli</a>.</p> ]]></content:encoded> <wfw:commentRss>https://francescolelli.info/programming/best-practices-on-how-to-write-comments-in-your-code/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <post-id
xmlns="com-wordpress:feed-additions:1">1640</post-id> </item> </channel> </rss>