RE: [PHP] dev style guide

From: Date: Tue, 05 Aug 2003 20:40:46 +0000
Subject: RE: [PHP] dev style guide
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-158350@lists.php.net to get a copy of this message
>At the risk of starting a flame/religious/holy war I find the One True >Brace style to have some inconsistency if it is as above. The 'function' >does not open the curly brace at the EOL, but the 'if' does. Yeah, that's pretty much the definition of the OTBS. :) I'm not sure why I find it so natural, but basically it acknowledges that function definitions are fundamentally different (in usage and meaning) than other code blocks. I like this. >I also mentioned me being and old-schooler earlier today but the rules >that we use in our (current) group always place the opening curly at the >EOL. Also, we do not allow ternary notation. Personally, I use ternary notation a lot, but I try to use it thusly: (condition ? statement 1 : statement 2) The line breaks make it easier to see what's going on. I don't think it really matters what standard you use, as long as you *have one* and everyone in your group agrees that it's a comfortable fit, which paradoxically seems to converge on something like what PEAR uses anyway. Anecdote: At one time, a member of our group decided (on their own) that the coding style should automatically prefer printf() constructions to double-quoted variable interpretation, and that it should be word-wrapped to fit within his 80-char vim terminal. An autoconversion script was written, files were drastically modified to conform, and then subsequently committed to CVS. This is not a proper way to go about implementing a coding standard. :P --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html

« previous php.general (#158350) next »