Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Idiomatic optimizations

by VSarkiss (Monsignor)
on Apr 29, 2002 at 17:12 UTC ( #162869=note: print w/replies, xml ) Need Help??

in reply to Idiomatic optimizations

Beyond performance improvement, some of these transformations usually render your code "more correct" (for some suitable definition of correct). Your first point, for example, about unnecessarily quoting variables: in my experience, it's a left-over bad habit of shell programmers. It can lead to errors in strange circumstances, particularly if $foo is an object, and the stringify operator does something you didn't expect, or you didn't realize the stringified version is not the same as the object itself.

More than optimizations, I would categorize these as "Refactoring". Generally speaking, it means changing code without adding functionality, but improving it in some fashion, such as making it easier to maintain. Fowler has an entire book on the subject. Although it uses Java, some of the principles apply to other languages as well.

I recall brother chromatic was working on a refactoring editor for Perl, based on using the B back-end compilers to generate a uniform code tree, then applying these types of changes. He referred to it in his journal on use perl, but I don't know its current state (though I'm sure it'll be thoroughly tested when it's released ;-).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://162869]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2018-03-22 18:04 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (282 votes). Check out past polls.