tag:blogger.com,1999:blog-8712770457197348465.post5558758892294435494..comments2024-03-19T01:04:48.783-07:00Comments on Javarevisited: 10 Best Practices to Follow While Writing Code Commentsjavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger19125tag:blogger.com,1999:blog-8712770457197348465.post-19101481603502965422022-06-10T01:10:06.202-07:002022-06-10T01:10:06.202-07:00niceniceransslothttps://www.blogger.com/profile/12719785397315644354noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-22623219682904428682021-08-18T04:17:21.976-07:002021-08-18T04:17:21.976-07:00NiceNiceVishalhttps://www.blogger.com/profile/15650686568044598499noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-43656809027182503732016-11-17T03:45:09.735-08:002016-11-17T03:45:09.735-08:00// Thank you :)// Thank you :)Anonymoushttps://www.blogger.com/profile/14499999545371931383noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-7228716528263359522016-03-07T03:23:53.987-08:002016-03-07T03:23:53.987-08:00Thanks for writing this post.Thanks for writing this post.Frank Millerhttps://www.blogger.com/profile/17074009441989602510noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-21811897461719086532015-12-11T03:00:19.954-08:002015-12-11T03:00:19.954-08:00What code doeas and how it does are two different ...What code doeas and how it does are two different things.<br />The //using Newton-Raphson method comment should have remained.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-73023929274467228322014-02-09T17:20:56.230-08:002014-02-09T17:20:56.230-08:00Checkstyle project is considering to add support f...Checkstyle project is considering to add support for Comments validation , please support proposals at https://groups.google.com/forum/#!topic/checkstyle/VEVFDsZKLzgRoman Ivanovhttps://www.blogger.com/profile/15430650019342632630noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-81207908602126373152013-06-02T07:05:24.922-07:002013-06-02T07:05:24.922-07:00That's the ideal case mate. If you can avoid, ...That's the ideal case mate. If you can avoid, than yes, best avoid writing comments, but sometime you need it; and then these best practices can help you to write better comments e.g. WHY part is very important, a simple statement describing a complex algorithm is worth writing.Javin @ Exception handling best practiceshttp://javarevisited.blogspot.com/2013/03/0-exception-handling-best-practices-in-Java-Programming.htmlnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-19278398357891916772013-04-29T23:19:31.131-07:002013-04-29T23:19:31.131-07:00I suggest, reading comment section of Clean code b...I suggest, reading comment section of Clean code book from Uncle Bob, lot's of good advice there e.g.<br />1) Code is your best form of comment, make code speak for itself.<br /><br />2) Only write comment which gives information, which is not visible from code e.g. don't write, what code does, what type it is, instead write name of algorithm if code id more cryptic.<br /><br />3) Don'Anirudhnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-34775548238644734662011-08-29T07:34:04.922-07:002011-08-29T07:34:04.922-07:00@thecodemechanic , you must be awesome very compet...@thecodemechanic , you must be awesome very competent developer man , someone borne with great coding and programming skill with natural ability of think through to write software which works on every possible scenario, but not all people are gifted buddy. though I personally appreciate your advice but that is just an ideal situation.Javin @ synchronized collection vs concurrent collectionhttp://javarevisited.blogspot.com/2011/04/difference-between-concurrenthashmap.htmlnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-39264442772190445582011-08-29T07:31:11.899-07:002011-08-29T07:31:11.899-07:00@asolntsev , Thanks for link buddy, though java do...@asolntsev , Thanks for link buddy, though java doc is more verbose it suits great for API but yes there are better alternatives on code commenting .Javin @ abstraction in javahttp://javarevisited.blogspot.com/2010/10/abstraction-in-java.htmlnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-41545547001555599362011-08-29T07:27:34.370-07:002011-08-29T07:27:34.370-07:00@Lexandro, writing unit test for maintenance code ...@Lexandro, writing unit test for maintenance code is not a bad idea, it certainly valuable but some time one line comment can do magic and allows to understand some important points about code which is require to think through various scenario.Javin @ thread interview questionshttp://javarevisited.blogspot.com/2011/07/java-multi-threading-interview.htmlnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-2439983174923580212011-08-29T05:23:09.233-07:002011-08-29T05:23:09.233-07:00writing a software required lot efforts and hard w...writing a software required lot efforts and hard work.Your tips about writing software helpful too much.Planing is must for writing a software.nalysalehttps://www.blogger.com/profile/10468411835737140924noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-31459462499572650422011-08-25T14:43:52.639-07:002011-08-25T14:43:52.639-07:00Here's my rules, and I have my asbestos underw...Here's my rules, and I have my asbestos underwear on so flame away: <br /><br />1) Don't write comments. Write better code. <br />2) Comments are an excuse, and you should only excuse something if you can't do it better. <br />3) Rather than write comments, use a design pattern. Convention (design patterns) are far superior to excuses. <br />4) If the business logic is so complex thatAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-74294380658733980772011-08-25T12:45:31.450-07:002011-08-25T12:45:31.450-07:00Hi,
I totally agree with most of your advices,
bu...Hi,<br />I totally agree with most of your advices, <br />but prefer not to writing javadoc in most cases. <br /><br />See http://asolntsev.blogspot.com/2010/05/why-devil-invented-javadoc.html for more details.<br /><br />PS. In 2. example, I would still add comment "// using Newton-Raphson method" because it's not clear from code.asolntsevhttps://www.blogger.com/profile/16632087166612261207noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-49592475358396095802011-08-25T02:15:40.076-07:002011-08-25T02:15:40.076-07:00Hi!
I suggest that you read Clean Code (http://go...Hi!<br /><br />I suggest that you read Clean Code (http://goo.gl/5EyY) chapter about code comments.<br /><br />Bye, Karlo.Karlo Smidhttps://www.blogger.com/profile/01048765558237756781noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-78632089032806168132011-08-25T01:32:57.037-07:002011-08-25T01:32:57.037-07:00"5) Include JIRA Number and description on co..."5) Include JIRA Number and description on comment,"<br /><br />Better to create a unit test with descriptive name instead putting jira related garbage into your code.<br /><br />Personally as TDD practicioner I'm preferring "test-as-documentation" principle to explain my intentions, bugfixes or other changes in the code. <br /><br />Another great place to put non code Lexandrohttps://www.blogger.com/profile/10617069183080733516noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-54633158368921175352011-08-21T18:35:53.813-07:002011-08-21T18:35:53.813-07:00cool tips buddy, specially javadoc comments and ha...cool tips buddy, specially javadoc comments and having JIRA number in comments , I personally follow itAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-35571697628959584482011-08-20T01:14:48.048-07:002011-08-20T01:14:48.048-07:00@Kumar, Thanks for your comment man. good to know ...@Kumar, Thanks for your comment man. good to know that you like this post.JP @ java debugging tutorialhttp://javarevisited.blogspot.com/2011/07/java-debugging-tutorial-example-tips.htmlnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-50072144084225807292011-08-20T00:59:45.007-07:002011-08-20T00:59:45.007-07:00I'd like to add that for javadoc comments it&#...I'd like to add that for javadoc comments it's best to use plugin in IDE like Checkstyle. This plugin will make sure you won't forget writing javadoc comments.<br /><br />And also it's crutial to write comments while you are writing a code. Not days/week/months/years later. You should never say that you will write comment later, because you won't. And if you do anyway, such Jirka Pinkashttp://www.java-skoleni.cznoreply@blogger.com