"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
luck, db
There are no new questions, but there may be new answers.
David Newton wrote:Tabs are evil. IDE/editor handles all that anyway
, and the headache of various alignment issues go away when you just stick with spaces.
Four spaces per tab. I'm also at 120 chars per line, but I get twitchy when I hit 90... but wrapping at 80 in Java is a recipe for unreadability.
Darryl Burke wrote:Cross posted
http://www.java-forums.org/advanced-java/32607-formatting-java-code.html
What alignment issues?
Why 120 characters?
I thought 80 was the standard for nearly forever?
Mike Simmons wrote:
Darryl Burke wrote:Cross posted
http://www.java-forums.org/advanced-java/32607-formatting-java-code.html
Yeah, but that one's about PHP code. Totally different question.![]()
Converting tabs to spaces.Debbie Dawson wrote:
David Newton wrote:Tabs are evil. IDE/editor handles all that anyway
Handles what anyways?!
If you use a different editor, the tabs may appear different sizes.
, and the headache of various alignment issues go away when you just stick with spaces.
What alignment issues?
Four spaces per tab. I'm also at 120 chars per line, but I get twitchy when I hit 90... but wrapping at 80 in Java is a recipe for unreadability.
Why 120 characters?
You can usually get a lot more than 80 columns onto a screen, but it is a good thing to have a limit as a convention, and stick to it.
Writing verbose code?
I thought 80 was the standard for nearly forever?
Debbie
One of our Readers insists on 3Debbie Dawson wrote: . . .
1 position?
2 positions?
4 positions? . . .
Campbell Ritchie wrote:If, however, I am writing FORTH and have to copy-and-paste[...]
Mike Simmons wrote:
Darryl Burke wrote:Cross posted
http://www.java-forums.org/advanced-java/32607-formatting-java-code.html
Yeah, but that one's about PHP code. Totally different question.![]()
David Newton wrote:
Mike Simmons wrote:Indeed--there's *no* way to make PHP code look good regardless of indentation.
Tell me how you *really* feel, David...![]()
Debbie
Campbell Ritchie wrote:
Mike Simmons wrote:
Darryl Burke wrote:Cross posted
http://www.java-forums.org/advanced-java/32607-formatting-java-code.html
Yeah, but that one's about PHP code. Totally different question.![]()
luck, db
There are no new questions, but there may be new answers.
Debbie Dawson wrote:
Mike Simmons wrote:
Darryl Burke wrote:Cross posted
http://www.java-forums.org/advanced-java/32607-formatting-java-code.html
Yeah, but that one's about PHP code. Totally different question.![]()
It's not a sin to get different people's opinions on things. (Thank you very much!)![]()
Debbie
luck, db
There are no new questions, but there may be new answers.
Darryl Burke wrote:
Mike Simmons wrote:
Darryl Burke wrote:Cross posted
http://www.java-forums.org/advanced-java/32607-formatting-java-code.html
Yeah, but that one's about PHP code. Totally different question.![]()
I take it you didn't read the thread title on the other forum.
Debbie Dawson wrote:
Campbell Ritchie wrote:
Don't lines automatically wrap in IDE's (even with Tabs)??
No, as David has said. You may get them displayed wrapped, but that would differ from IDE to IDE, and you would still get that problem when displaying on a text editor, with code tags, on paper, etc.Debbie Dawson wrote: . . . Don't lines automatically wrap in IDE's (even with Tabs)??
I am surprised your company didn't have a policy about tabs and spaces.Matthew Brown wrote:. . . I have a strong preference for 4-space indentation. He had a strong preference for 2 spaces. . . .
SCJP 1.5
"A candle looses nothing by lighting another candle"
itechmentors.com
Campbell Ritchie wrote:
I am surprised your company didn't have a policy about tabs and spaces.Matthew Brown wrote:. . . I have a strong preference for 4-space indentation. He had a strong preference for 2 spaces. . . .
Matthew Brown wrote:I usually use spaces nowadays, but you simply can't solve the above problem with spaces - tabs make it trivial.
David Newton wrote:
Matthew Brown wrote:I usually use spaces nowadays, but you simply can't solve the above problem with spaces - tabs make it trivial.
Yeah, actually you can.
David Newton wrote:Re-format it: convert to required format on SCCS checkin/checkout, or on editor load/save, or whatever. Most dev tools can be set up to do this automatically.
It still won't handle the real issue (mixed-mode alignment), but it allows crazy 8-spaces-per-tab people to not screw up everybody else's day.
We have a very strict indentation policy here at Teesside University. Everybody must have a different indentation policy from everybody else. If two people use the same indentation policy, there is a £20000000 budget cut and half the department are offered early retirement!Matthew Brown wrote: . . . You've never worked in a University then?
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |