User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,576 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,256 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

Opinions? javascript/php/etc and programming standards

Join Date: Sep 2005
Posts: 674
Reputation: digital-ether has a spectacular aura about digital-ether has a spectacular aura about 
Rep Power: 5
Solved Threads: 39
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Practically a Master Poster

Help Re: Opinions? javascript/php/etc and programming standards

  #11  
Mar 27th, 2007
Originally Posted by chewbacca810 View Post
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
$name = $user->name();

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!
Reply With Quote  
All times are GMT -4. The time now is 10:47 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC