<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" 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/" > <channel><title>Comments on: 10 Most Useful Java Best Practice Quotes for Java Developers</title> <atom:link href="http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html/feed" rel="self" type="application/rss+xml" /><link>http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html</link> <description>Tutorials, Java, J2EE, Struts, AJAX, JavaScript, CSS, Web 2.0, MySQL, Articles</description> <lastBuildDate>Wed, 08 Feb 2012 10:36:26 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: lakshmipathi-lucky</title><link>http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html/comment-page-2#comment-25827</link> <dc:creator>lakshmipathi-lucky</dc:creator> <pubDate>Sat, 04 Feb 2012 10:32:05 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2021#comment-25827</guid> <description>useful information for java programmers</description> <content:encoded><![CDATA[<p>useful information for java programmers</p> ]]></content:encoded> </item> <item><title>By: madhavan</title><link>http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html/comment-page-2#comment-25782</link> <dc:creator>madhavan</dc:creator> <pubDate>Thu, 02 Feb 2012 07:28:23 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2021#comment-25782</guid> <description>Hey all nice comment . Good explanation it is necessary for all java programers to follow this steps . Thanks Man.nice job</description> <content:encoded><![CDATA[<p>Hey all nice comment . Good explanation it is necessary for all java programers to follow this steps . Thanks Man.</p><p>nice job</p> ]]></content:encoded> </item> <item><title>By: Tasty Sauce Code</title><link>http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html/comment-page-1#comment-24426</link> <dc:creator>Tasty Sauce Code</dc:creator> <pubDate>Sat, 14 Jan 2012 15:26:17 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2021#comment-24426</guid> <description>Inside the Student class is not a private member variable. It&#039;s a private member reference. Therefore you have 1 object, but 2 aliases. Changing one will affect the underlying object, and so any proceeding uses of either will have the last update in full effect.</description> <content:encoded><![CDATA[<p>Inside the Student class is not a private member variable. It&#8217;s a private member reference. Therefore you have 1 object, but 2 aliases. Changing one will affect the underlying object, and so any proceeding uses of either will have the last update in full effect.</p> ]]></content:encoded> </item> <item><title>By: Luka</title><link>http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html/comment-page-1#comment-21559</link> <dc:creator>Luka</dc:creator> <pubDate>Wed, 04 Jan 2012 10:38:36 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2021#comment-21559</guid> <description>Great article... Thanks... One question, though... Regarding the example with student class. Why would value of student.birthDate variable be changed???Date birthDate = new Date(); Student student = new Student(birthDate); birthDate.setYear(2019);You create a date object, you create a Student object passing it the value of newly created Date and then you change the value of it... I don&#039;t get it... Student object when it&#039;s created creates a private local member variable with the value that was passed when calling the constructor and that was Date()This would make sense:Date birthDate = new Date(); birthDate.setYear(2019); Student student = new Student(birthDate);Can someone please clarify me this behaviour :) Thanks</description> <content:encoded><![CDATA[<p>Great article&#8230; Thanks&#8230;<br /> One question, though&#8230;<br /> Regarding the example with student class. Why would value of student.birthDate variable be changed???</p><p>Date birthDate = new Date();<br /> Student student = new Student(birthDate);<br /> birthDate.setYear(2019);</p><p>You create a date object, you create a Student object passing it the value of newly created Date and then you change the value of it&#8230; I don&#8217;t get it&#8230; Student object when it&#8217;s created creates a private local member variable with the value that was passed when calling the constructor and that was Date()</p><p>This would make sense:</p><p>Date birthDate = new Date();<br /> birthDate.setYear(2019);<br /> Student student = new Student(birthDate);</p><p>Can someone please clarify me this behaviour <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Thanks</p> ]]></content:encoded> </item> <item><title>By: merijn</title><link>http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html/comment-page-1#comment-20057</link> <dc:creator>merijn</dc:creator> <pubDate>Wed, 28 Dec 2011 12:17:58 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2021#comment-20057</guid> <description>Lazy instantiation is probably premature optimization, especially in example #1.An api shouldn&#039;t return null in normal conditions, nullchecking everything leads to ugly code.If an exceptional sitation occurs, an api should throw and not return null instead, because if you do return null, the burden for errorchecking (and raising an exception) lies at every caller.</description> <content:encoded><![CDATA[<p>Lazy instantiation is probably premature optimization, especially in example #1.</p><p>An api shouldn&#8217;t return null in normal conditions, nullchecking everything leads to ugly code.</p><p>If an exceptional sitation occurs, an api should throw and not return null instead, because if you do return null, the burden for errorchecking (and raising an exception) lies at every caller.</p> ]]></content:encoded> </item> <item><title>By: Greg Dougherty</title><link>http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html/comment-page-1#comment-18662</link> <dc:creator>Greg Dougherty</dc:creator> <pubDate>Wed, 14 Dec 2011 21:56:32 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2021#comment-18662</guid> <description>Got to disagree with you on #9.1: Unless the routine&#039;s documentation specifically promises it will never return null, you should be checking for null, and failure to do so is poor quality and sloppy programming.2: Null and Empty List quite often mean different things.  For example if you pass invalid data to a search routine, it might return null.  If you pass valid data, but there are no results, then it should return an empty list.  The situations are semantically distinct, therefore the results should be distinct, too.Lazy instantiation is good.  Lazy programming, OTOH, is bad.</description> <content:encoded><![CDATA[<p>Got to disagree with you on #9.</p><p>1: Unless the routine&#8217;s documentation specifically promises it will never return null, you should be checking for null, and failure to do so is poor quality and sloppy programming.</p><p>2: Null and Empty List quite often mean different things.  For example if you pass invalid data to a search routine, it might return null.  If you pass valid data, but there are no results, then it should return an empty list.  The situations are semantically distinct, therefore the results should be distinct, too.</p><p>Lazy instantiation is good.  Lazy programming, OTOH, is bad.</p> ]]></content:encoded> </item> <item><title>By: Deepak jabghela</title><link>http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html/comment-page-1#comment-17898</link> <dc:creator>Deepak jabghela</dc:creator> <pubDate>Sat, 19 Nov 2011 06:41:02 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2021#comment-17898</guid> <description>Good list, thanks for the tips.</description> <content:encoded><![CDATA[<p>Good list, thanks for the tips.</p> ]]></content:encoded> </item> <item><title>By: Aman Mohla</title><link>http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html/comment-page-1#comment-16833</link> <dc:creator>Aman Mohla</dc:creator> <pubDate>Tue, 01 Nov 2011 05:50:33 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2021#comment-16833</guid> <description>Nice compilation viral, and specially coupled with the comments, it became even more informative.</description> <content:encoded><![CDATA[<p>Nice compilation viral, and specially coupled with the comments, it became even more informative.</p> ]]></content:encoded> </item> <item><title>By: Deepak Patil</title><link>http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html/comment-page-1#comment-16689</link> <dc:creator>Deepak Patil</dc:creator> <pubDate>Wed, 19 Oct 2011 07:13:53 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2021#comment-16689</guid> <description>Thanks. nice List</description> <content:encoded><![CDATA[<p>Thanks. nice List</p> ]]></content:encoded> </item> <item><title>By: Jorge Urdaneta</title><link>http://viralpatel.net/blogs/2010/02/most-useful-java-best-practice-quotes-java-developers.html/comment-page-1#comment-15735</link> <dc:creator>Jorge Urdaneta</dc:creator> <pubDate>Fri, 19 Aug 2011 17:00:10 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=2021#comment-15735</guid> <description>Another Quote:&quot;Don&#039;t use String + operator for succesive string addition. Use StringBuilder instead&quot; Suponse you&#039;re constructing a large string in a forString ids=&quot;&quot;; for (int pid : personIds) ids = ids + pid + &quot; &quot;;The compiler will convert it to something like ids = new StringBuffer().append(ids).append(pid).append(&quot; &quot;).toString(); Impacting performance with all those StringBuffer and its arrays beign created and then dropped for later garbage collectionInstead create your own StringBuilder like thisStringBuilder myBuilder=new StringBuilder(); for (int pid : personIds) myBuilder.append(pid).append(&quot; &quot;); String ids=myBuilder.toString();</description> <content:encoded><![CDATA[<p>Another Quote:</p><p>&#8220;Don&#8217;t use String + operator for succesive string addition. Use StringBuilder instead&#8221;<br /> Suponse you&#8217;re constructing a large string in a for</p><p>String ids=&#8221;";<br /> for (int pid : personIds)<br /> ids = ids + pid + &#8221; &#8220;;</p><p>The compiler will convert it to something like<br /> ids = new StringBuffer().append(ids).append(pid).append(&#8221; &#8220;).toString();<br /> Impacting performance with all those StringBuffer and its arrays beign created and then dropped for later garbage collection</p><p>Instead create your own StringBuilder like this</p><p>StringBuilder myBuilder=new StringBuilder();<br /> for (int pid : personIds)<br /> myBuilder.append(pid).append(&#8221; &#8220;);<br /> String ids=myBuilder.toString();</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: viralpatel.net @ 2012-02-09 10:30:56 -->
