Re: CS discussion

From: Date: Wed, 16 Jul 2003 09:13:09 +0000
Subject: Re: CS discussion
References: 1 2 3 4 5  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-66@lists.php.net to get a copy of this message
On Tue, 2003-07-15 at 21:04, Jon Parise wrote: > On Tue, Jul 15, 2003 at 02:22:12PM +0100, Bruno Pedro wrote: > > It might *look* better but it has a problem: the operators. The lines > > should break before the operators, not after. But breaking the lines > > before the operators decreases readibility: > > > > <?php > > if ( > > (condition1) > > || (condition2) > > ) { > > action1; > > } > > ?> > > I disagree. The operator should remain on the original line to > indicate that the line itself should be continued. It is unnatural to > write something like this: > > (something + somethingElse > + anotherThing) I also prefer that solution (I suggested that in the first place), but after taking a look at the Java Coding Standard Version 2.0 "Line length" section I came across this: (...) When a complete statement or an expression will not fit on a single line, break it according to these general principles: 1. Break after a comma. 2. Break before an operator. 3. Prefer higher-level breaks to lower-level breaks. 4. Align the new line with the beginning of the expression at the same level on the previous line. 5. If the above rules lead to confusing code or to code that's squished up against the right margin, just indent one additional level instead. Anyway, from a readibility point of view, I prefer breaking after the operator. I just felt like adding this option to the discussion. Regards -- Bruno Pedro PTM.com Key fingerprint = B398 3A92 704F C74D A984 2424 26F0 189E 9FEE CDC8 http://search.keyserver.net:11371/pks/lookup?op=get&search=0x9FEECDC8

Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
« previous php.pear.qa (#66) next »