Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re (tilly) 1: Favorite Descriptive Variable Name

by tilly (Archbishop)
on Dec 21, 2000 at 23:52 UTC ( #47880=note: print w/ replies, xml ) Need Help??


in reply to Favorite Descriptive Variable Name

To go with all of these temporary variable names, here is a useful naming convention.

Make all of your flags be questions starting with "is".

One of the most common errors people make is to reverse what a flag is supposed to stand for. For instance if you are looking at a variable called $status_flag, is 1 success or failure? Who knows? Much better to call it $is_ok or $is_bad as appropriate, then there is no room for confusion.

The rule is, Say what you mean, mean what you say, and stop saying it before you mess up! Make your variables say your story. Don't leave landmines by changing what they mean. Don't make people have to maintain stuff in both comments and code. So on and so forth...


Comment on Re (tilly) 1: Favorite Descriptive Variable Name

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2014-09-16 04:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (156 votes), past polls