I’ve always been trying to understand a little bit more about project life-cycles: how and when do you consider a codebase mature? When does it become considered “legacy” code that people would rather rewrite than fix?
So equipped with git-iterate, I ran flog over the Ruby on Rails code, dating back from its first commit: in four years, it went from the loudly announced opinionated web framework that was promising to take over the world to something that actually accomplished it: tons of start-ups are using it all over the world, and there’s a thriving market for jobs and books and brought Ruby adoption into the near-mainstream while at it.
Meanwhile, the complexity of its code steadily increased: from roughly 16k flog points to ~95k, which is quite a big jump. I was tempted to cry “bloatware!” when, investigating further, I noticed a plateau around 4/5ths of the chart: the tests were increasing, but the code was actually stable or becoming simpler; new features added and bugs fixed without bloating it up!
That’s what I wanted to see in a mature and stable codebase: people begin finding analogies and abstractions that fit the solution a bit better, and small improvements pile up until you see most code size or complexity metrics decrease. It’s still no guarantee that the right problems are being solved, but at least it states that the problem it is solving is being solved well.
You might be asking yourself what happens towards the end of the chart, where there’s a big spike. Near the end of March, Geoff Buesing added an abbreviated version of the TZInfo gem, which is one of the steps taken toward getting timezone support going, one of the biggest new features in Rails 2.1. While it could be considered bloat, not including a dependency on another gem keeps things a lot easier for a bunch of people (plus, if you happen to have the tzinfo gem with a more recent version, it’ll just use that).
In conclusion, good work Railers!

Yehuda Katz | 26-Jul-08 at 6:58 pm | Permalink
What steps did you take to go from the raw flog output to the chart?
Carlos Villela | 26-Jul-08 at 7:29 pm | Permalink
Uploaded the CSV into Google Docs and generated a chart. The spreadsheet is here:
http://spreadsheets.google.com/ccc?key=pZ_qxWU0Fx8lYcUG-nGa_RA&hl=en
Paul Battley | 26-Jul-08 at 9:36 pm | Permalink
I don’t know how flog’s metrics work, but the fact that tzinfo contains a lot of code for what is really data (a module for Ulaan Bataar, ffs?!) can’t help with the complexity ratings.
Jean-Francois Couture | 27-Jul-08 at 4:56 pm | Permalink
Do you think you could label the different rails releases on your graph? That would be interesting.
Carlos Villela | 27-Jul-08 at 7:36 pm | Permalink
Hi Jean! Unfortunately it’s unlikely I’ll have the time in the next week. but thanks for the suggestion, that is a great idea!
Daniel Lopes | 27-Aug-08 at 7:36 pm | Permalink
Great post…