Zen and the total lines of code
by Abigail (Deacon) on Jun 28, 2001 at 21:24 UTC
|
Three programmers applied for a position at the Master.
The Master asked each of them how many lines of code they produce
daily. The first programmer proudly said "1000". The second programmer
boasted "1200". The third programmer wispered she sometimes has
"-100" lines on her tally.
The Master asked the student who he would hire. The second programmer,
of course, the student replied.
The Master hired the third programmer, and the student was enlightened.
--Abigail
| [reply] |
Re: counting total lines of code
by bikeNomad (Priest) on Jun 28, 2001 at 04:43 UTC
|
I'm sure others will point this out, but "lines of code" is both hard to count (especially in Perl because of its potential density) and not a particularly useful metric for anything (like scheduling).
However, if I were counting lines of code for comparison, I'd remove comments and blank lines, as it's the same code without them, and probably run it through perltidy or some other formatter to standardize the format. If you're estimating schedules, you should be able to apply some factor to compare uncommented code with commented code.
You may want to look into other metrics if you're actually using these numbers for anything other than curiosity. Robert C. Martin proposed some OO ones for C++-like languages in one of his books (sorry, I don't have the title); "cyclomatic complexity" takes into account the number of decision points in your code; there's also "feature point" and "function point" metrics which have the advantage of (theoretically) being computable before you code.
As far as whether your program is large, I'll let others answer this better, but it seems pretty large to me. | [reply] |
Re: counting total lines of code
by Aighearach (Initiate) on Jun 28, 2001 at 04:38 UTC
|
| [reply] |
Re: counting total lines of code
by petdance (Parson) on Jun 28, 2001 at 06:51 UTC
|
The number of lines of code is irrelevant as an absolute
number, just like "hits" on a web page. Say your project
is 50,000 lines instead of 60,000. What's the difference?
What will be done once magic number $nlines is found?
Where the measurements are important is when comparing two (or twenty) different numbers. Say you've got these measurements on your projects:
| Date | Lines w/comments | Lines w/o comments |
| 4/1 (Start) | 0 | 0 |
| 5/1 | 5,000 | 4,000 |
| 6/1 | 10,000 | 7,500 |
| 7/1 | 12,000 | 10,000 |
You can see that you've been going along at a nice clip
for the first two months, and then in June everything slowed
down.
The relationship between lines w/comments and lines w/o doesn't exactly match, but it's close enough for you to say
"Hey, look, we're slowing down."
What's important is that you track it consistently, so that
the comparisons are meaningful. In the example above, if you switch measurement from with to without comments, it looks like you've made zero increase in a month, which isn't the case.
xoxo,
Andy
--
I was dreaming when I wrote this, so sue me if I go too fast.
| [reply] [d/l] |
Re: counting total lines of code
by Beatnik (Parson) on Jun 28, 2001 at 10:08 UTC
|
Sticking everything on one line makes it a one-liner. Perl is ideal for exotic line formatting, obfuscation and JAPHs. merlyn can probably rewrite a 5,000 line script in 500 lines (or less). I think you need to ask yourself, do I need 50,000 lines of code? :))))
Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur. | [reply] |
|
|
Talking about merlyn. He has a script to count lines...column 57 of hise famous webtechniques column :)
-- My opinions may have changed,
but not the fact that I am right
| [reply] |
Re: counting total lines of code
by cLive ;-) (Prior) on Jun 28, 2001 at 08:15 UTC
|
| [reply] |