Xcode Statistician

So, ever wonder just how big your code base is? For some value of “how big” being how many lines, how many statements, how many characters, how many words, how many classes? How about “all of the above”? Why yes, here you go:

How Big is Your Code Base?

describing Xcode Statistician, part of the code and tools goodies collection to be found here.

And as a little exercise, let’s see what it gives us for the biggest project we’ve done recently:

qmasterstats.png

First reaction being “What? 2,097,113 characters? Is that ALL? Seemed like a lot more at the time…” comprising 23,766 statements on 58,357 non-whitespace lines in 174 classes. Neat to know, certainly, even if using any of these as a direct evaluation metric is rather silly mind you. But we do like the idea from the source post of taking the word count and relating it to non-code writing. Using the Nebula Award standards:

< 7.5K words: short story

7.5K – 17.5K words: novelette

17.5K – 40K words: novella

40+K words: novel

Now, we can add some refinements to that from real world observation.

70K words: Smallest generally publishable adult novel, Western and romance lines stick at about this length.

80K – 110K words: Usual publishable range, particularly for new writers. (Although the first Harry Potter was not quite 77K, and that worked out all right.)

110+K words: Epic. Common in the fantasy space up to about 150K, otherwise only for Big Name Writers™ pretty much.

390+K words: Robert Jordan.

(If anyone knows a bigger novel than The Shadow Rising let us know, but we’re pretty darn sure it’s the biggest we’ve ever read.)

So Qmaster is about the equivalent of:

  • Two and a half Harlequin Romances
  • Two average-ish thriller/mystery novels
  • Not quite half of The Fires of Heaven

Yeah, that sounds pretty much right. And rather more intuitively graspable than spewing a raw LOC number, indeed. I wonder if the author would open source this project? It would be rather amusing indeed to populate it with the word counts of popular novels so that you could express your output compared to the author of your choice, wethinks.

h/t: @Dylan_Beadle!

Alex | November 1, 2010
  • Ray Wenderlich November 2, 2010 at 7:43 am
    Lol. Awesome tool and hilarious commentary :]
  • Karl Becker November 2, 2010 at 9:09 pm
    Nice tool, and good writeup :) However, it doesn't seem to include subdirectories... am I missing something? Your epic novel does not have all the source files under the project's root directory, does it?
  • Alex November 2, 2010 at 10:19 pm
    Nope, if there is a trick to getting it to recurse I missed it too. For the screenshot there I just dumped all the source files into one folder.
  • Ricardo Ruiz López March 20, 2014 at 2:35 am
    Hello! It does nothing when opening a xcode 5 project. Is it compatible? Thanks.
  • Alex Curylo March 20, 2014 at 7:23 am
    Something written in 2010 isn't too likely to be compatible with Xcode 5, no. Think there's some utilities that do similar things up on the Mac App Store these days.
  • KingVicc April 9, 2014 at 12:10 am
    Actually it works. Make sure you're selecting the correct folder. Say your app project is "AwesomeApp" and it's sitting on your desktop. Double click that folder, and inside you'll find another folder with the same name. That's the folder you set it to. I can confirm it works on Xcode 5.1

Leave a Reply