Wednesday, March 2, 2011

Turbulence, measuring the turbulent nature of your code

Recently, Michael Feathers has been investigating the idea of mining all the data in our source code repositories to start finding information about our codebase and system design. He wrote an article about possibly using a churn v complexity chart to look for areas that could use some refactoring love called "Getting Empirical about Refactoring".
Since he has joined Obtiva as Chief Scientist, he is here in Chicago fairly frequently. I had the pleasure of spending a morning with him, and we naturally talked about his ideas. I was inspired to build a short bash script that generated a churn graph for my own codebase on MercuryApp. Chad Fowler took my short script and merged it with a script he wrote to run Flog over the codebase. While Michael, Chad and I were in Boulder, CO, for a coderetreat this past weekend, we put together a project called Turbulence.

Turbulence is a gem that you install and run in the directory of your code. It does a churn report, combines it with Flog data, and generates a nice scatter plot view. You can find instructions on the Turbulence project page. Although it currently only support Ruby code, we have plans for expanding the project to support other languages.

One goal is to have people take a screenshot of their graph and post it to twitter with the hashtag #codeturb. This will allow us to view the graphs on hashalbum and see what we can see.

Another goal is to have people send us their data, so we can do some analysis on different contexts. If you'd like to take part in this project, please email me. We are working on finishing up an anonymizer function that will mask the filenames, in case you might worry about directory structures/file names giving away your codebase's dirty secrets.

We are also proposing a series of talks at conferences outlining both results, recommendations and tools for helping analyzing your design based on the shape of your metrics. Keep watch for those.

I've uploaded my current graph for MercuryApp, you can see it in all its glory by clicking on the picture below.
#codeturb on Twitpic


  1. I seem to be having gem dependency problems with my code base. Turbulence requires Launcy-0.4.0 but my system already has 0.3.7 activated. Not sure why, or how.

    lib/ruby/site_ruby/1.8/rubygems.rb:233:in `activate': can't activate launchy (~> 0.4.0, runtime) for ["turbulence-0.0.9"], already activated launchy-0.3.7 for ["open_gem-1.4.2"] (Gem::LoadError)

  2. Hi, Tony.
    Interesting. Can you try running bule with bundle exec to see if that helps.

    If I were you, I'd completely remove all Launchy installs and then do a fresh install. We need 0.4.0, as it allows launching local files.

  3. It looks like this is a problem caused by open_gem having a launchy depedency and also being a gem plugin (which means you don't get to choose when it's loaded). IMO gem plugins shouldn't introduce dependencies on other gems.


Please don't post anonymously; I won't use your name/url for anything insidious.
Comments by Anonymous are not guaranteed to make it through moderation.
Constructive comments are always appreciated.