Wednesday, March 26, 2008

Complexity and code count (Michael Neale)

Every now and then I like to take stock of the drools codebase, and look at some stats. One of my favourite tools for this is sloccount. Easy to use command line (yum install sloccount on fedora).

Totals grouped by language (dominant language first):
java: 243736 (99.57%)
jsp: 520 (0.21%)
ruby: 243 (0.10%)
sh: 146 (0.06%)
python: 135 (0.06%)

So, about a quarter of a million lines of code. Thats a lot of complexity (and hopefully power) hidden beneath the surface. Hopefully most people don't have to worry about this complexity (we try to keep the interfaces simple - try).

The thing about complexity is sometimes (just sometimes) it is necessary, and you can roll your own complexity, or use someone elses. Mostly I prefer someone elses.

For many years, sewing machines were a mystery to me. I never knew how they actually used the thread to connect stuff together. I also knew I didn't need to know (in fact, when suffering insomnia I would try and solve it in my mind). But I knew they worked, and I knew it was easier to use them then roll your own.
Well not entirely relevant, but I think its cool that someone made an animated GIF showing how they actually work:


2 comments:

  1. javancss is also pretty handy and it's very easy to drop into a maven build:

    <reports>
    <report>
    <groupId>org.codehaus.mojo</...>
    <artifactId>javancss-maven-plugin</...>
    </...>
    </reports>

    then just run "mvn site"

    ReplyDelete
  2. on multiprojects you tend to need to run it twice (at least with the old version) to get the aggregated report

    http://mojo.codehaus.org/javancss-maven-plugin/

    ReplyDelete