Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-25 23:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found