At 07:06 AM 2/17/2006, Jeff wrote:
I've got some code from someone else I've inherited and need to sort out
some problems with. The programmer that wrote it originally was much
better than I and programmed a little over my head to say the least.
One function that I've come across that has 5 variables as input:
function($var1,$var2,!$var2,$var3->cc,$var3->bcc);
Jeff,
I can understand why you'd think someone was more proficient at a
given language if they knew shortcuts and back alleys in the language
that you hadn't yet learned. However, in my view a major aspect of
being a good programmer is writing clearly documented or
self-documenting code. The whole purpose of script is to be easy for
humans to read. If a script is obscure, I think that's more likely a
failure of the author than the reader.
$var2,!$var2,
I have to question the elegance of code that persuades the programmer
to pass the same variable twice, once as vanilla and again as NOT
vanilla. I'd first check to make sure that this negation weren't
something better performed within the function itself.
function($var1,$var2,
I don't know if your clip was a literal quote from that other
person's script, but I wouldn't happily hire or work with a
programmer who preferred to use variable names like "var1" and "var2"
-- unless the function were an abstrated meta-function, say part of a
compiler; and in that case I'd likely omit the literal arguments and
process an abstract argument array. Self-documenting variable names
like $sLogon (type string) and $bLoggedOn (type Boolean) that
indicate both purpose and type make programming, debugging, and later
modification much, much easier.
Paul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php