Originally Posted by
chewbacca810
i having been programming for 10+ years now, so I always try to adhere to good programming practices (variable naming, spacing, etc). Yet, almost every snippet of code for JS or PHP that you can pull up goes against those practices.
even when writing JS or PHP, where var type isn't nearly as strict as, say, Java, I'll write:
objDiv = document.getElementById( "thediv" );
or
$strName = $objUser->name();
but even examples on sun.com or php.net look like
o = document.getElementById("thediv"); or
I understand they're both scripting languages, but I don't feel that is any reason to deviate from good programming practices.
Anyone else feel this way still, or has the whole world gone insane and I'm just wasting precious keystrokes?
Do you guys think inline documentation can be a good coding practice?
Especially for PHP (other "typeless" scripting languages) as you cannot explicitly declare functions and properties of a class as private/public. And you cannot specify the datatypes of variables and function returns.
Could this be an alternative to having to name variables with type information?
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!