Coding standards... and me.

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

I wouldn't treat any language like another unless they are genuinely similar. JavaScript and PHP have some things in common but generally they are very different. I also think that coding standards are probably even more important in JavaScript because the language is more prone to abuse.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

superdezign wrote:but one thing I noticed is that a few site said we should not use '//' style comments. Is this true?
Depends upon context. I would never do this:

Code: Select all

//Sends a redirect to $url
public function redirect($url) {
}
That wouldn't document with a documenting tool. It should be this:

Code: Select all

/**
 * Sends a redirect to $url.
 * @param string $url
 */
public function redirect($url) {
}
But I would definitely use //comments inside the body of a function where the flow of logic is.
Post Reply