Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Perl vs. Compilable Language

by mstone (Deacon)
on May 03, 2005 at 01:55 UTC ( #453465=note: print w/replies, xml ) Need Help??


in reply to Re^2: Perl vs. Compilable Language
in thread Perl vs. Compilable Language

Familiarity does play a role, but Perl has a very low LOC:FP (lines of code per function point) ratio. There's a table here which compares several languages (it's toward the bottom of the page). Function points are a well-defined measure of how much work a program does, so the LOC:FP ratio more or less compares the sizes of programs that do the same thing in different languages.

In the referenced table, assembly has a LOC:FP ratio of 575. C runs 225. Fortran runs 210. C++ and Java run about 80. Perl weighs in at 50.

The ratio matters because research has shown that the cost of a single line of code remains more or less constant regardless of what language you use. Languages that do the most with the fewest lines of code tend to be more economical over the long run.

No matter how familiar someone is with C++, they still have to write a certain amount of memory management code. Java has garbage collection, but you have to write the boilerplate and conversion code associated with its strict type system. Those trim back some of the advantages gained from familiarity.

The ratio is just an average, though. And for the relatively small difference between Java/C++ and Perl, there are plenty of other factors which can tip the balance either way.

Replies are listed 'Best First'.
Re^4: Perl vs. Compilable Language
by Anonymous Monk on May 03, 2005 at 11:04 UTC
    I don't give LOC:FP much weigth. Sure, it's nice that Perl has a possible low LOC:FP, but take that to the extreme, we'd all be golfing all the time.

    In many cases, given various ways of handling a small task (a "function point" for instance) the clearest solution is often the most wanted. And that can easily take two or three times as many lines as the shortest.

    The ratio matters because research has shown that the cost of a single line of code remains more or less constant regardless of what language you use.
    I'm not so sure about that. I write both Perl and C code for my living, although I write far more Perl than C. I've been programming Perl for over 10 years, and C for over 15. My Perl programs use less lines of code than my C programs, for doing similar tasks. But I tinker with my written Perl much more than with C. With C, there's often one obvious way, a standard idiom, or when it's written, it's not worthwhile to redo it. But with Perl, there's always yet another way. There's always the itch to change a few lines, to make it just a tad bit better.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2019-06-18 15:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (82 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!