[GenABEL-dev] [Genabel-commits] r1139 - pkg/ProbABEL/src

Maarten Kooyman kooyman at gmail.com
Fri Mar 15 11:00:53 CET 2013


Hi Yurii et al,

As you might known there are quite some users who like to have the
P-value in there Probabel output. The part where the output is handled
is quite complex and I did not had at first sight  a clue where to
start without being afraid that the whole thing would fall like house
of cards. This was the main functions (which should not do output, but
that is a topic of another discussion) It had a McCabe index
(cyclomatic complexity)  of over 80. To keep a long story short:
everything with a cyclomatic complexity over 30 is might be sketchy in
terms of code quality and in terms of code maintainability just
plainly bad.  You can find more about this at
http://en.wikipedia.org/wiki/Cyclomatic_complexity.

I was able to simplify the code because the part were each snp  is
"calculated" was duplicated for two cases: one for probability files
and one dose files.  I merged the 2 parts of code which removed lots
of duplicated code and some of the cyclomatic complexity: this dropped
by almost 20 percent to 67. This is still far from perfect but it is a
start.


Kind regards,

Maarten Kooyman

p.s. 2 tools to calculate this kind of statistics:
CCCC - C and C++ Code Counter (Command line tool which outputs in html)
metriculator- a plugin for Eclipse CDT (I like this one! )

On Thu, Mar 14, 2013 at 9:22 AM, Yurii Aulchenko
<yurii.aulchenko at gmail.com> wrote:
> Hi Maarten,
>
> Wow - not a trivial amount of code commented out. Great job on cleaning the
> ProbABEL!
>
> best,
> Yurii
>
>
> On Wed, Mar 13, 2013 at 11:07 PM, <noreply at r-forge.r-project.org> wrote:
>>
>> Author: maartenk
>> Date: 2013-03-13 23:07:17 +0100 (Wed, 13 Mar 2013)
>> New Revision: 1139
>>
>> Modified:
>>    pkg/ProbABEL/src/main.cpp
>> Log:
>> commented out unneeded code (+-230 lines) and removed some duplicated code
>> by a function
>>
>>
>
> _______________________________________________
> genabel-devel mailing list
> genabel-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/genabel-devel


More information about the genabel-devel mailing list