In my experience, Number of Lines is a completely meaningless value. Here's a great example. Some people on my programming team spent 4 months programming some software which took 30,000 lines (as counted by wc -l). They were applauded for doing "good work". Later, I spent a mere 2 days culling over the code and removing 3,000 lines. I was also applauded. But if lines of code is a measure of work... doesn't removing lines mean I'm destroying work?

Not at all, and everyone knows this. When I sorted through the code, I was making it much more readable, understandable, and just take advantage of many features which Perl allowed.

Lines of code only measures the programmer's understanding of the problem.

It's very important to realize this. "Everything should be made as simple as possible, but not simpler." If you have too few lines of code, you might not fully understand the problem. If you have too many lines of code, maybe you've missed an elegant solution. But there's just no way to know if a solution is "good" or "bad". You can only compare it to other solutions..

A better metric of how well code is written is to go over a section of code and explain it to someone else. Time how long it takes for someone else to understand the body of code. Your metric is time / lines. Note that line counts include comments, because comments aide in the (mis)understanding of the problem. This metric gives you a far better understanding of true code ellegance. Well written code will be easier to understand than poorly written code.

-Ted

In reply to Line Counts are (mostly) Meaningless by tedv
in thread Line-counts of perl programs/modules by Tarka

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.