What's your text to code ratio?

by Jonathan Wellons

When I was a software developer for the O'Reilly Network (articles and blogs, like the one you're reading now), I probably wrote about 3 to 5 times as much text as code. It was a lot of code, but in my role as an analyst, I sent a lot of email and IMs about the state of our systems and data.

I had a consulting job last summer where the ratio was more like 1 to 5: a lot of code as I built a website from scratch in Perl, and less text: status updates and discussion of features.

Now that I'm a Ph.D. student in Computer Science, it's probably more like 50 to 1. I write essays, papers, reviews, exercise solutions, even comments on homework I grade. What do I code? Not much, only one of my 4 classes this semester involves programming, and it was all in Lisp where a little code goes a long way (oh, and also some Prolog).

I've always done plenty of coding on personal projects (where there may be little or no text at all), but I can say my text to code ratio for my primary job has gone from medium to low to high. Or something like that -- I don't know what's normal.

What is your estimated text to code ratio? I'm thinking character-to-character comparision, but if you think time spent is better, feel free. It can be from your job, or your hobbies, or both, but please don't mix them. And how would you count documentation?


2007-04-17 10:07:13
Strictly in terms of considerations leading to some form of "project quality" metric, my personal experience is that a high-quality project will invariably end up having had at least 75% of its total time spent in non-coding design-phase (not counting pseudo-code); any less than that will lead to much greater overall time spent on the project, and a much higher percentage of high-severity bugs in the first code-generation.
Jonathan Wellons
2007-04-17 17:59:45
Dear Doug,

Definitely. Normative numbers are cool too, but what do you find for yourself empirically?

2007-09-02 22:52:27
Recently wrote a little spyware app for myself that tracks which application currently has focus on my machine. I spend about 2 hours a day at work in Visual Studio and about 3 hours a day in email/IM apps.

(Incidentally, I spend only about another hour doing stuff on the computer, and then the rest of the day is spent in meetings, working through problems with other programmers and, since I'm a console game developer, playing our video games.)

2007-09-02 22:55:42
... and I guess that doesn't answer your exact question about the per-character ratios, but it seemed like relevant information, nonetheless.
Jonathan Wellons
2007-09-03 14:09:31
Dear John,

Still very interesting. Thanks!

I wonder how it compares to other engineers/other kinds of software development...