<?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: Static Analysis tools &gt; Experience</title> <atom:link href="http://ocpsoft.com/best-practices/static-analysis-tools-experience/feed/" rel="self" type="application/rss+xml" /><link>http://ocpsoft.com/best-practices/static-analysis-tools-experience/</link> <description>&#34;Simple Software&#34;</description> <lastBuildDate>Mon, 26 Jul 2010 23:17:02 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0</generator> <item><title>By: Raghu M</title><link>http://ocpsoft.com/best-practices/static-analysis-tools-experience/#comment-637</link> <dc:creator>Raghu M</dc:creator> <pubDate>Sat, 16 May 2009 08:10:58 +0000</pubDate> <guid
isPermaLink="false">http://ocpsoft.com/?p=51#comment-637</guid> <description>This is a never ending debate. Although I agree the argument of experts evading the tool enforcement, what is the guarantee that experts do not commit mistakes? There is no reason why the tool usage always results in a dreadful situation. In fact, I find not using a tool has led to pain than otherwise. Unit testing, code metrics are measures of code quality, no matter how expert the developer(s) is/are.What matters is the amount of tool usage. In a highly automated environment where daily builds are happening more than once every day, monitoring commits and generating reports, it makes a lot of sense to integrate these tools. Having this in place is just as good as 50% work done.I think enforcing the tool usage (by making it a part of commit) is the issue. Instead, senior members in the team could take the responsibility of doing smart code reviews. This is as good as using the tool itself (might be better at times). However, the advantages of unit testing tool or code metrics tool are too good to be ignored.</description> <content:encoded><![CDATA[<p>This is a never ending debate. Although I agree the argument of experts evading the tool enforcement, what is the guarantee that experts do not commit mistakes? There is no reason why the tool usage always results in a dreadful situation. In fact, I find not using a tool has led to pain than otherwise. Unit testing, code metrics are measures of code quality, no matter how expert the developer(s) is/are.</p><p>What matters is the amount of tool usage. In a highly automated environment where daily builds are happening more than once every day, monitoring commits and generating reports, it makes a lot of sense to integrate these tools. Having this in place is just as good as 50% work done.</p><p>I think enforcing the tool usage (by making it a part of commit) is the issue. Instead, senior members in the team could take the responsibility of doing smart code reviews. This is as good as using the tool itself (might be better at times). However, the advantages of unit testing tool or code metrics tool are too good to be ignored.</p> ]]></content:encoded> </item> <item><title>By: Jilles van Gurp</title><link>http://ocpsoft.com/best-practices/static-analysis-tools-experience/#comment-626</link> <dc:creator>Jilles van Gurp</dc:creator> <pubDate>Thu, 14 May 2009 17:30:26 +0000</pubDate> <guid
isPermaLink="false">http://ocpsoft.com/?p=51#comment-626</guid> <description>Sorry but I think you are wrong here.
1) many static code analysis tools are useless without some configuration. Pmd is one of such tools. Findbugs on the other hand is pretty much OK out of the box. Experts tune these tools until they have the right set of rules and then use the tools to make sure juniors don&#039;t screw up (which they will otherwise). Almost every day I find stuff with checkstyle or findbugs that one of the guys in my team committed and I make them fix it. This ranges from stupid stuff to otherwise extremely hard to spot concurrency bugs. This alone is a reason to never ever go without static code analysis.
2) the tools don&#039;t lie and most of the rules (that survive after you configure) are based on sound principles. An expert understands these principles and will recognize violations of rules as a problem.
3) Arguing against well established practices is a sign of an advanced beginner, not of an expert. It&#039;s very simple: either the rule is always right or it is always wrong. In the latter case, configure your tool to not apply the rule. That&#039;s OK, we all do this. In the former case: zero tolerance is the only right thing to do. The tool makes this dead easy.I recently inherited a project that was big pile of stinking crap and all my static code analysis tools confirmed this (though technically I didn&#039;t need those to confirm this). When maintaining big stinking piles of code, analysis tools, test tools, etc. are your friend.Step 1: fix all of those findbugs issues. You know dereferencing null values, redundant null checks, misguided use of the synchronized keyword, etc. Step 2, use code coverage tools to figure out what code is not being tested. Step 3: fix this, ruthlessly deleting dead code in the process (if it has no test and nobody seems to use it: delete and ask questions later). Step 4: Refactor, the hell out of the project. Breaking things is going to happen from time to time. But then once you fix it, your code will be better. Step 5 work on the code until you have 0 warnings with the code analysis tools running on each save in eclipse (no expert would turn those off). This probably requires some decision taking on which rules to keep and which not. Step 6: turn on code cleaning on save in eclipse. Really, this saves so much time and arguing. Our eclipse config comes straight from maven so all team members use it. Hooks up the code analysis tools as well. Great stuff.Indeed no replacement for code reviews, unit, integration, and manual end-to-end testing. But then nobody claims this and you shouldn&#039;t rely on those processes either to find stupid rule violations and instead focus more on correctness &amp; design of the code.</description> <content:encoded><![CDATA[<p>Sorry but I think you are wrong here.<br
/> 1) many static code analysis tools are useless without some configuration. Pmd is one of such tools. Findbugs on the other hand is pretty much OK out of the box. Experts tune these tools until they have the right set of rules and then use the tools to make sure juniors don&#8217;t screw up (which they will otherwise). Almost every day I find stuff with checkstyle or findbugs that one of the guys in my team committed and I make them fix it. This ranges from stupid stuff to otherwise extremely hard to spot concurrency bugs. This alone is a reason to never ever go without static code analysis.<br
/> 2) the tools don&#8217;t lie and most of the rules (that survive after you configure) are based on sound principles. An expert understands these principles and will recognize violations of rules as a problem.<br
/> 3) Arguing against well established practices is a sign of an advanced beginner, not of an expert. It&#8217;s very simple: either the rule is always right or it is always wrong. In the latter case, configure your tool to not apply the rule. That&#8217;s OK, we all do this. In the former case: zero tolerance is the only right thing to do. The tool makes this dead easy.</p><p>I recently inherited a project that was big pile of stinking crap and all my static code analysis tools confirmed this (though technically I didn&#8217;t need those to confirm this). When maintaining big stinking piles of code, analysis tools, test tools, etc. are your friend.</p><p>Step 1: fix all of those findbugs issues. You know dereferencing null values, redundant null checks, misguided use of the synchronized keyword, etc. Step 2, use code coverage tools to figure out what code is not being tested. Step 3: fix this, ruthlessly deleting dead code in the process (if it has no test and nobody seems to use it: delete and ask questions later). Step 4: Refactor, the hell out of the project. Breaking things is going to happen from time to time. But then once you fix it, your code will be better. Step 5 work on the code until you have 0 warnings with the code analysis tools running on each save in eclipse (no expert would turn those off). This probably requires some decision taking on which rules to keep and which not. Step 6: turn on code cleaning on save in eclipse. Really, this saves so much time and arguing. Our eclipse config comes straight from maven so all team members use it. Hooks up the code analysis tools as well. Great stuff.</p><p>Indeed no replacement for code reviews, unit, integration, and manual end-to-end testing. But then nobody claims this and you shouldn&#8217;t rely on those processes either to find stupid rule violations and instead focus more on correctness &amp; design of the code.</p> ]]></content:encoded> </item> <item><title>By: Dale</title><link>http://ocpsoft.com/best-practices/static-analysis-tools-experience/#comment-624</link> <dc:creator>Dale</dc:creator> <pubDate>Thu, 14 May 2009 14:17:25 +0000</pubDate> <guid
isPermaLink="false">http://ocpsoft.com/?p=51#comment-624</guid> <description>Some comments about PMD:Out of the box, PMD can be overly verbose.  It is easy to let it run more rules than is necessary.  One of the &quot;expert&quot; developers should set up the rulesets that will be enforced.  Even after that, the rules should still be considered guidelines.  As the article mentioned, there are often good reasons for a particular code construct that may violate a PMD rule.  PMD supports both annotations and special comments that allow the developer to indicate to PMD (and to other developers) that they are ignoring the PMD rule on purpose.  A good developer will also add a comment indicating why they are ignoring the rule.  It is also possible to suppress PMD warnings for an entire class, so in the example from the article, the developer has a better choice: make the fix for the NPE, then suppress PMD warnings for the class.  This should also serve as an indication that the class needs to be revisitied, but gives the developer a way to make a critical fix on a tight deadline without having to &quot;fix&quot; a bunch of legacy code that has worked fine for years.</description> <content:encoded><![CDATA[<p>Some comments about PMD:</p><p>Out of the box, PMD can be overly verbose.  It is easy to let it run more rules than is necessary.  One of the &#8220;expert&#8221; developers should set up the rulesets that will be enforced.  Even after that, the rules should still be considered guidelines.  As the article mentioned, there are often good reasons for a particular code construct that may violate a PMD rule.  PMD supports both annotations and special comments that allow the developer to indicate to PMD (and to other developers) that they are ignoring the PMD rule on purpose.  A good developer will also add a comment indicating why they are ignoring the rule.  It is also possible to suppress PMD warnings for an entire class, so in the example from the article, the developer has a better choice: make the fix for the NPE, then suppress PMD warnings for the class.  This should also serve as an indication that the class needs to be revisitied, but gives the developer a way to make a critical fix on a tight deadline without having to &#8220;fix&#8221; a bunch of legacy code that has worked fine for years.</p> ]]></content:encoded> </item> <item><title>By: Hayden Jones</title><link>http://ocpsoft.com/best-practices/static-analysis-tools-experience/#comment-605</link> <dc:creator>Hayden Jones</dc:creator> <pubDate>Tue, 12 May 2009 18:59:23 +0000</pubDate> <guid
isPermaLink="false">http://ocpsoft.com/?p=51#comment-605</guid> <description>Use FindBugs and consult Bill Pugh&#039;s talk at JavaOne 2008 called &#039;Using FindBugs in Anger&#039; about what to do about large code bases (in short use your discretion about what bugs can be left alone and what needs to be fixed).</description> <content:encoded><![CDATA[<p>Use FindBugs and consult Bill Pugh&#8217;s talk at JavaOne 2008 called &#8216;Using FindBugs in Anger&#8217; about what to do about large code bases (in short use your discretion about what bugs can be left alone and what needs to be fixed).</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Served from: ocpsoft.com @ 2010-07-29 17:12:16 by W3 Total Cache -->