Re: Is 80-column source code formatting still standard ?
André Pang <[email protected]>
| Newsgroups | gmane.org.user-groups.slug.chat |
|---|---|
| Message-ID | <[email protected]> |
On 25/06/2008, at 3:34 PM, Mary Gardiner wrote: > One point in favour of approx 80 character lines in both code and > writing is that apparently there is some suggestion that it's much > more natural to read text of that width than it is to read really long > lines. I entirely agree that shorter lines of text make for easier reading, but I'm not convinced that argument applies to code. If you have a big expression, you don't have too many choices. You can split the expression up into its own dedicated functions, which may lower readability by forcing you to navigate around the file to figure out what's going on. You can use shorter variable names, but that almost always lowers code readability. You can assign sub-expressions to intermediate variables, but then you have the burden of naming the variables for the sub-expressions, plus you probably also want to mark that intermediate variable as immutable (const) otherwise it's one more possible stateful variable to keep track up when trying to understand how a function works. I don't think it'll be hard to find cases where a 160-character line is a lot more maintainable than trying to split it into 3 or 4 lines of 50 columns each. -- SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
smime.p7s
(application/pkcs7-signature, 3.4 KB) - not displayed