Dear Maarten,<div><br></div><div>Many thanks for this post - it was very interesting to read about cyclomatic complexity. Something new for me! </div><div><br></div><div>Also many thanks for mentioning the tools - definitely something to run my code through next time.</div>
<div><br></div><div>best wishes,</div><div>Yurii<br><br><div class="gmail_quote">On Fri, Mar 15, 2013 at 11:00 AM, Maarten Kooyman <span dir="ltr"><<a href="mailto:kooyman@gmail.com" target="_blank">kooyman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Hi Yurii et al,<br>
<br>
As you might known there are quite some users who like to have the<br>
P-value in there Probabel output. The part where the output is handled<br>
</div><div class="im">is quite complex and I did not had at first sight a clue where to<br>
start without being afraid that the whole thing would fall like house<br>
of cards. This was the main functions (which should not do output, but<br>
that is a topic of another discussion) It had a McCabe index<br>
(cyclomatic complexity) of over 80. To keep a long story short:<br>
everything with a cyclomatic complexity over 30 is might be sketchy in<br>
terms of code quality and in terms of code maintainability just<br>
plainly bad. You can find more about this at<br>
<a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity" target="_blank">http://en.wikipedia.org/wiki/Cyclomatic_complexity</a>.<br>
<br>
</div>I was able to simplify the code because the part were each snp is<br>
"calculated" was duplicated for two cases: one for probability files<br>
<div class="im">and one dose files. I merged the 2 parts of code which removed lots<br>
of duplicated code and some of the cyclomatic complexity: this dropped<br>
by almost 20 percent to 67. This is still far from perfect but it is a<br>
start.<br>
<br>
<br>
Kind regards,<br>
<br>
Maarten Kooyman<br>
<br>
</div>p.s. 2 tools to calculate this kind of statistics:<br>
CCCC - C and C++ Code Counter (Command line tool which outputs in html)<br>
metriculator- a plugin for Eclipse CDT (I like this one! )<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, Mar 14, 2013 at 9:22 AM, Yurii Aulchenko<br>
<<a href="mailto:yurii.aulchenko@gmail.com">yurii.aulchenko@gmail.com</a>> wrote:<br>
> Hi Maarten,<br>
><br>
> Wow - not a trivial amount of code commented out. Great job on cleaning the<br>
> ProbABEL!<br>
><br>
> best,<br>
> Yurii<br>
><br>
><br>
> On Wed, Mar 13, 2013 at 11:07 PM, <<a href="mailto:noreply@r-forge.r-project.org">noreply@r-forge.r-project.org</a>> wrote:<br>
>><br>
>> Author: maartenk<br>
>> Date: 2013-03-13 23:07:17 +0100 (Wed, 13 Mar 2013)<br>
>> New Revision: 1139<br>
>><br>
>> Modified:<br>
>> pkg/ProbABEL/src/main.cpp<br>
>> Log:<br>
>> commented out unneeded code (+-230 lines) and removed some duplicated code<br>
>> by a function<br>
>><br>
>><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> genabel-devel mailing list<br>
> <a href="mailto:genabel-devel@lists.r-forge.r-project.org">genabel-devel@lists.r-forge.r-project.org</a><br>
> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/genabel-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/genabel-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>-----------------------------------------------------<br>Yurii S. Aulchenko<br><div><br></div><div>[ <a href="http://nl.linkedin.com/in/yuriiaulchenko" target="_blank">LinkedIn</a> ] [ <a href="http://twitter.com/YuriiAulchenko" target="_blank">Twitter</a> ] [ <a href="http://yurii-aulchenko.blogspot.nl/" target="_blank">Blog</a> ]</div>
</div>