Redundancy in Programming Languages
Russell Lewis
webmaster at villagersonline.com
Fri May 9 11:06:39 PDT 2008
bearophile wrote:
> (huge snip)
> ...I have nearly never fallen in [the variable name typo] trap in Python...
I write a little in PHP for my website, and I hit it *all the time*.
If you are writing a program (or a new function) from scratch, you don't
hit it often, because you have recent memory of the names you used. But
when you are maintaining barely-remembered old code (as is usually my
case on the website) it is *VERY* common.
Remind me...was that variable named "fieldOK", "fieldOk", "fieldFound",
"foundField", "field_found", or "results[fieldFound]" ?
It's even worse when you are accessing somebody else's library. I
recently got bit on things like:
- $_SERVER[REDRIECT_URL] (had to change to $_SERVER[REQUEST_URI] when
PHP version changed...but no warnings, just weird chdir() errors whenI
used the wrong variable)
- $_SERVER[REQEUST_URI] (typo)
- $_POST is used on some pages, $_GET on others...reads of undefined
fields just silently return empty values
- urldecode() (actual function name is url_decode() )
Just a few examples I hit recently.
Ofc, YMMV.
More information about the Digitalmars-d
mailing list