I love historic figures and statistics, regardless of whether there’s a defined purpose for them. Part of my intrinsic instinct to hoard, I guess. :)
I’ve been working slowly but steadily on my Keychain framework again, which has been reminding me – if nothing else – that it’s really important to write good code to start with. :/
Anyway, on this particular project, since I had grand plans for it right from the start, I collected basic LOC numbers sporadically. (LOC = Lines Of Code, a completely useless & meaningless measure, but trivial to take).
Sometime in early or mid 2003, not long – presumably – after I’d started, the core framework had a whopping 649 lines in it. And there were also 2089 lines of documentation, although I think that included all paraphernalia even vaguely related.
Some time later, again in 2003, that had grown to 4,639 lines. Plus a whole bunch of other stuff that had spun off; I was up to 12,888 lines (may or may not be counting documentation; didn’t record it explicitly).
By the 8th of August, 2003, it was 15,864 (!!!) lines for the core framework, plus more than that again in the various side projects (Secure Distributed Objects (SDO) materialises here, 3,865 lines by itself). At this point it’s by far the biggest project (in terms of LOC) I’d ever worked on.
It seems I spent the next two or three weeks of August devoted to SDO, as that increased by nearly a thousand LOC in that time.
In the first two or three weeks of October I added 1,500 LOC to SDO, and 2,500 to the docs (again, probably a catch-all for all sorts of junk).
The next time I recorded stats was the 28th of January, 2004 – a Wednesday, I meticulously noted – by which time the core framework was sitting at 16,290 LOC, and various other side projects had grown a bit, such that the total LOC – excluding docs – was 33,210. This was the summer I was working at DPI in Attwood, so I wasn’t coding too much on anything but my work there (which, FWIW, amounted to roughly 27,966 LOC – not bad for three months of work)
Nearly 7 months later, on the 24th of August, total LOC was 36,511, of which 17,236 was the core framework. Plus 6,585 lines of docs.
It was over two years before I next recorded stats – I didn’t work on the framework or anything related very much at all in this time, as this was my fourth & fifth years of uni, which were busy enough as it was. On the 22nd of November, 2006, there were 23,589 lines in the core framework (plus 4,036 in testers). All told there were 47,109 LOC (plus 7,740 lines of docs). Pretty insane for what was meant to be just a incidental stepping stone on the road to my real project!
And that brings us to today. I’ve been working on the framework quite a bit, relatively speaking, in the last few months or so. The core framework is, as of right now in SVN, 25,071 LOC. Plus 3,090 in testers and 3,137 in strings files alone. At this point it really kicks in how useless LOC is. Despite the appearance that I’ve hardly added any new code – and have in fact lost a thousand lines of testers) the reality is the framework is in much better shape now than a year ago. Vast portions of it now actually work (always nice), and there’s all sorts of new functionality. Now that I’ve got a good five years of ObjC & Cocoa under my belt, I’m finding that the old ways I had of doing things were typically grossly inefficient, redundant, or both. So I’ve been cutting out redundancy, and that alone has probably saved thousands of lines.
I’ve also added in a lot of HeaderDoc documentation, which bloats the count as well.
In comparison, the largest project I’d tackled prior to Apple was the MISS – our third year Computer Science project. There were eight of us in our group, although only half or so did the vast majority of the coding. (and I’ve just noticed one of the files is called ‘BorlandEats.cpp’… nice :D)
I also remember that I had some scripts or somesuch I wrote to collect stats from CVS, so Michael & I especially had a bit of an unspoken competition going to see who could get the most lines modified and most commits. I can’t recall who won, actually… I suspect it might have been him, but I think he cheated. :P I do remember we both had over a thousand commits each. And we didn’t go so far as to make completely spurious commits – they were all at least partly genuine.
Anyway, that whole project weighed in at a grand sum of 39,620 LOC, give or take. Of that, I wrote roughly 23,063 lines (actually some amount less, because I know some of what I’m counting Rob & Tony wrote, but, I can’t be bothered going through it in that much detail). So let’s say 20k, because everyone likes arbitrary rounding.
That’s a lot of code. Granted, in that project we enjoyed liberal use of the “copy-paste” pattern of code reuse, so, I definitely wouldn’t use LOC to derive any measure of quality or completeness. Still, that project was written, from start to finish, in about six weeks, from memory. That’s a lot of code for six weeks. And a lot of it actually worked, too, despite my whim at the time to use C++ templates like they were going out of fashion, which produced some beautiful diabolical compiler & linker issues, and meant only I could possibly hope to comprehend what the hell any of my code did. Haha, job security. :D
Of course I can’t reveal any numbers for the stuff I do at Apple – nor do I know any off hand, anyway – but I think it’s quite likely that the Keychain framework still represents the biggest single body of work of mine, in terms of LOC.
I’ve just realised I don’t appear to have any work documents from NEC. I can’t recall if that’s intentional or not… I vaguely remember deciding not to preserve any after I finished – trade secrets and good faith and security concerns and all that – but I’ll have to check my ancient backups to see if I just accidentally trashed it at some point. Anyway… I have no idea how many LOC I wrote there. I think I recorded them periodically in my logbook, but again, that got left behind. Damn it!
It was quite a lot, though.. I think by then I’d started to settle into my current general style of logging, which is very verbose. I love debugging my own code. If something goes wrong, it prints out a virtual backtrace, detailing exactly why every function or method failed from the end-developer right into the bowels where it occurred. So you go look at the exact lines that are relevant, and can usually figure out what’s wrong in all of about four seconds flat. (fixing it’s another thing entirely) I hate dealing with code that has no logging… something fails… oh, okay, well, just go through the code in your head, starting from main(), and see if anything jumps out at you. WTF?!?!
I’m guessing I’ve well exceeded 100,000 LOC written – in C, C++ & ObjC – since I started uni some five and a half years ago now… there was also a fair bit done before then, but largely in RealBasic and similar high-level languages, and smaller projects.
Yet I’m sure the Perl purists out there will be itching to explain how I could have done all that in just three lines of Perl, and one regular expression.
Well anyway, that’s enough nostalgia for now… at some point I think I’ll get LOC stats for every project I still have source for, to get a real idea of just how many times I’ve hit the return key… but that’s for another time.