mjparrott / Cap-It

Caption It Facebook game
0 stars 0 forks source link

Decide on bracket/indentation style. #4

Open mjparrott opened 10 years ago

mjparrott commented 10 years ago
if (cond) {
  stmt1;
} else {
  stmt2;
}

vs.

if (cond)
{
  stmt1;
}
else
{
  stmt2;
}

Is there a preference as to what style we use?

And for the if statement, should be include a space after the if and before the bracket?

swmyuen commented 10 years ago

im about the first style lololol

On Feb 20, 2014, at 10:26 PM, Michael Parrott notifications@github.com wrote:

if (cond) { stmt1; } else { stmt2; } vs.

if (cond) { stmt1; } else { stmt2; } Is there a preference as to what style we use?

And for the if statement, should be include a space after the if and before the bracket?

— Reply to this email directly or view it on GitHub.

piggyandy commented 10 years ago

I've been doing the 2nd style. But I feel the 1st style is what everyone's used to. I will reformat all the js code I've done.

And as for the if statement, I like the space after the 'if'. What about you guys?

mjparrott commented 10 years ago

I'm more used to the second style for the brackets.

Space after the if is probably a good call as well.

piggyandy commented 10 years ago

I think the 1st style may be the better option. In this article, http://robertnyman.com/2008/10/16/beware-of-javascript-semicolon-insertion/ the author mentioned the issue of 'semicolon insertion' when using the 2nd style.

There's a guy named Douglas Crockford who is well known for development in JS as well as popularizing JSON, he has a set of JS coding convention that could act as a good guideline for us in the JS code. http://javascript.crockford.com/code.html

mjparrott commented 10 years ago

Okay, we'll follow the coding conventions set out by the article there for Javascript. Will put that article on the Wiki.

For PHP, I found 2 things we could use: Zend coding conventions (http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards) or PEAR (http://pear.php.net/manual/en/standards.php). It looks like Zend is more popular, from some Googling.

mjparrott commented 10 years ago

We'll use this for PHP: http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards