Re: How to write code: how wrong am I?
| From: | larry@garfieldtech.com | Date: | Tue, 22 Feb 2011 18:09:52 +0000 |
| Subject: | Re: How to write code: how wrong am I? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311529@lists.php.net to get a copy of this message | ||
On 2/22/11 12:04 PM, Alexis wrote:
On 22/02/11 09:40, Dotan Cohen wrote:The most important thing is that you are consistent within a project and within a team. Your entire team should be consistently using one format standard, whatever it is. Failure to do so results in unreadable code, because your brain has to shift gears depending on who wrote a given block of code. That's bad news. I'd rather see code written in brace-on-own-line style (which I despise) than code that freely switches between that and inline-brace style (my preference) every other for-loop. That's simply unreadable. --Larry GarfieldOn Tue, Feb 22, 2011 at 16:15, Robert Cummings<robert@interjinn.com> wrote:Well the way you do it, drives me nuts :) Morale of the story, do whatever *you* are most comfortable with..personally I indent as well, has it's downsides I admit, but it's what I've done for the last 20 years and I'm comfortable with it. AlexisIf you switch to vertically aligned braces you will have an easier time matching up open and close braces... if (something) { // Code here } It's trivial to match using this style since you only need to scan one axis.That bracing style drives me nuts! But I have no problem scanning a single axis for the close brace and any statement, be it an if, while, switch, or something else.