Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: The qq{worse is better} approach (discussion)

by tachyon (Chancellor)
on Jul 02, 2001 at 19:24 UTC ( [id://93201]=note: print w/replies, xml ) Need Help??


in reply to The qq{worse is better} approach (discussion)

I think it is important to remember that selecting the right tool for the job is an important part of being a good programmer. I think everyone would agree you wouldn't use C++ for your example, however it doesn't make a case for using Perl over a shell script either. Accoring to Damian Conway there is a linear relationship between the length of a piece of code and the munber of bugs it will have and that shell script is shorter...

Like you I like to write nice clean self contained elegant efficient reusable code which I hoard in my personal snippets chest. Most of this stuff is junk that just litters the hard drive but sometime these things come in handy again and I am glad I wrote them well in the first place. Sadly as time passes my definition of good code changes in the light of increased experience. Some of my old code is just horrible. But I loved it at the time.

Be careful you don't fall into the Perl for everything trap like I did. It's a disease you know, with no know cure.

cheers

tachyon

PS Suppose you won't like my sig ;-)

s&&rsenoyhcatreve&&&s&n\w+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

  • Comment on Re: The qq{worse is better} approach (discussion)

Replies are listed 'Best First'.
Re: Re: The qq{worse is better} approach (discussion) - Length of Code vs. Errors in Code
by clemburg (Curate) on Jul 02, 2001 at 22:17 UTC

    Accoring to Damian Conway there is a linear relationship between the length of a piece of code and the munber of bugs it will have and that shell script is shorter...

    A better reference for this can be found in Code Complete, chapter 21, "How Program Size Affects Construction", page 523, from a study done in 1977 (Jones, T. Capers. 1977. Program Quality and Programmer Productivity. IBM Technical Report TR 02.764, January, 42-78.).

    In short:

    Project Size in Lines of CodeError Density in Errors per 1K lines of code
    < 2K0 - 25
    2K - 16K0 - 40
    16K - 64K0.5 - 50
    64K - 512K2 - 70
    > 512K4 - 100

    Page 610 (in Chapter 25, "Unit Testing") cites "15 to 50 errors per 1000 lines of code for delivered software" as "industry average experience".

    Note however that this data is very old, and new methods for software construction may give better results. Also, some organizations, most notably NASA projects, have achieved much, much better error rates, mostly by introducing rigorous testing and code review schemes. Also note the enormous variance in the data above.

    Christian Lemburg
    Brainbench MVP for Perl
    http://www.brainbench.com

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://93201]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-19 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found