<?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: Why do people code like that? And how do you review it?</title>
	<atom:link href="http://blog.hma-info.de/2009/11/01/why-do-people-code-like-that-and-how-do-you-review-it/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hma-info.de/2009/11/01/why-do-people-code-like-that-and-how-do-you-review-it/</link>
	<description>Fabians random thoughts about work and private life</description>
	<lastBuildDate>Sat, 02 Jul 2011 11:40:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Frank</title>
		<link>http://blog.hma-info.de/2009/11/01/why-do-people-code-like-that-and-how-do-you-review-it/comment-page-1/#comment-26741</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Sat, 10 Jul 2010 22:44:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hma-info.de/?p=203#comment-26741</guid>
		<description>I only know c++, I am self taught with no formal training. From what I can see in the code above ...  if (!&quot;&quot;==paramString.trim() &amp;&amp; paramString.trim().length() &gt; 0 &amp;&amp; paramString != null) ... The author is check to see if the string&#039;s param is not null. and each of the 3 checks appears to be doing the same thing from a different approach. Im not sure if this is necessary, or not. I think I would of used a method/function instead.

The basic algorithm I would try to implement here would be on the lines of this...

Instead of using an if statement. I would use a function that returns a bool to whether or not the string is empty or not. 

PROTOTYPE:   bool StringLength( ParamN paramN, ParamN+1 paramN+1, ... , ParamN+N paramN+N ) where the amount of parameters needed for each case would be passed in. The fewer the better.

Please reply about this comment. I could use advise myself.</description>
		<content:encoded><![CDATA[<p>I only know c++, I am self taught with no formal training. From what I can see in the code above &#8230;  if (!&#8221;"==paramString.trim() &amp;&amp; paramString.trim().length() &gt; 0 &amp;&amp; paramString != null) &#8230; The author is check to see if the string&#8217;s param is not null. and each of the 3 checks appears to be doing the same thing from a different approach. Im not sure if this is necessary, or not. I think I would of used a method/function instead.</p>
<p>The basic algorithm I would try to implement here would be on the lines of this&#8230;</p>
<p>Instead of using an if statement. I would use a function that returns a bool to whether or not the string is empty or not. </p>
<p>PROTOTYPE:   bool StringLength( ParamN paramN, ParamN+1 paramN+1, &#8230; , ParamN+N paramN+N ) where the amount of parameters needed for each case would be passed in. The fewer the better.</p>
<p>Please reply about this comment. I could use advise myself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://blog.hma-info.de/2009/11/01/why-do-people-code-like-that-and-how-do-you-review-it/comment-page-1/#comment-26705</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Tue, 13 Apr 2010 08:26:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hma-info.de/?p=203#comment-26705</guid>
		<description>I think Pike and Kernighan&#039;s &quot;The Practice of Programming&quot; is a great book to recommend to people who write this kind of code. (I even enjoyed reading it myself) Anything ever written by Pike is highly recommended :)

&quot;The Pragmatic Programmer&quot; is another example of a good book, but more for how to become a better programmer on the long term.</description>
		<content:encoded><![CDATA[<p>I think Pike and Kernighan&#8217;s &#8220;The Practice of Programming&#8221; is a great book to recommend to people who write this kind of code. (I even enjoyed reading it myself) Anything ever written by Pike is highly recommended <img src='http://blog.hma-info.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#8220;The Pragmatic Programmer&#8221; is another example of a good book, but more for how to become a better programmer on the long term.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas Ebbert-Karroum</title>
		<link>http://blog.hma-info.de/2009/11/01/why-do-people-code-like-that-and-how-do-you-review-it/comment-page-1/#comment-26480</link>
		<dc:creator>Andreas Ebbert-Karroum</dc:creator>
		<pubDate>Tue, 10 Nov 2009 23:01:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hma-info.de/?p=203#comment-26480</guid>
		<description>Also the null check in the end is very interesting -- you will get a NullPointerException if that parameter really IS null, before that check is executed ;) I can only guess, that this code started with the not null check and then grew step by step with bugfixing efforts (without tests, just messing with the code, until the bug is gone)

What would be nice:
if (StringUtils.isNotEmpty(paramString))

... even more readable in my opinion.</description>
		<content:encoded><![CDATA[<p>Also the null check in the end is very interesting &#8212; you will get a NullPointerException if that parameter really IS null, before that check is executed <img src='http://blog.hma-info.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  I can only guess, that this code started with the not null check and then grew step by step with bugfixing efforts (without tests, just messing with the code, until the bug is gone)</p>
<p>What would be nice:<br />
if (StringUtils.isNotEmpty(paramString))</p>
<p>&#8230; even more readable in my opinion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Friedel</title>
		<link>http://blog.hma-info.de/2009/11/01/why-do-people-code-like-that-and-how-do-you-review-it/comment-page-1/#comment-26475</link>
		<dc:creator>Friedel</dc:creator>
		<pubDate>Tue, 03 Nov 2009 23:38:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hma-info.de/?p=203#comment-26475</guid>
		<description>offtopic:
Am I your top commentator?</description>
		<content:encoded><![CDATA[<p>offtopic:<br />
Am I your top commentator?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Friedel</title>
		<link>http://blog.hma-info.de/2009/11/01/why-do-people-code-like-that-and-how-do-you-review-it/comment-page-1/#comment-26474</link>
		<dc:creator>Friedel</dc:creator>
		<pubDate>Tue, 03 Nov 2009 23:36:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hma-info.de/?p=203#comment-26474</guid>
		<description>LOL
sorry for trolling again.
I&#039;m not allowed (or willing) to show some crazy WTF code we saw in our company.
One guideline in Code Reviews is, that we review the code and not our colleague - and we are used to see crazy code. Our code base has some really old modules which were tweaked over years. Some evil sins (C macro magic horror) have already been removed by newer, fancier implementations (which are sometimes questionable, too). Also,  our working atmosphere is so good that we can blame each other as brainless idiots. We don&#039;t do this! Really! But I believe that nobody in my team would be hurt if we do so.
Therefore my only recommendation is having a nice atmosphere.

Our problem is, that we often loose our focus on the code we are reviewing. We end up in discussions how to solve the problem in general and in a generic way. This is contra productive sometimes. 


A footnote about tools:
I suppose JSLint is just the Java-incarnation of lint which we are using for ages. Also I&#039;d like to notice that code writers in other languages (explicitly in C and C++) often try to use different compilers. Different compilers generate different warnings. However this is not as powerful as static code analysis. In my business this is already a requirement (see FDA Software Validation Guidance). I&#039;d also like set a link to http://www.schneier.com/blog/archives/2009/05/software_proble.html</description>
		<content:encoded><![CDATA[<p>LOL<br />
sorry for trolling again.<br />
I&#8217;m not allowed (or willing) to show some crazy WTF code we saw in our company.<br />
One guideline in Code Reviews is, that we review the code and not our colleague &#8211; and we are used to see crazy code. Our code base has some really old modules which were tweaked over years. Some evil sins (C macro magic horror) have already been removed by newer, fancier implementations (which are sometimes questionable, too). Also,  our working atmosphere is so good that we can blame each other as brainless idiots. We don&#8217;t do this! Really! But I believe that nobody in my team would be hurt if we do so.<br />
Therefore my only recommendation is having a nice atmosphere.</p>
<p>Our problem is, that we often loose our focus on the code we are reviewing. We end up in discussions how to solve the problem in general and in a generic way. This is contra productive sometimes. </p>
<p>A footnote about tools:<br />
I suppose JSLint is just the Java-incarnation of lint which we are using for ages. Also I&#8217;d like to notice that code writers in other languages (explicitly in C and C++) often try to use different compilers. Different compilers generate different warnings. However this is not as powerful as static code analysis. In my business this is already a requirement (see FDA Software Validation Guidance). I&#8217;d also like set a link to <a href="http://www.schneier.com/blog/archives/2009/05/software_proble.html" rel="nofollow">http://www.schneier.com/blog/archives/2009/05/software_proble.html</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

