I'm going to letter them for sanity's sake...BK
class Curmudgeon { int iErrors; }or B)
class Curmudgeon { int iErrors; }Which is preferable?
I'll add a third option: C)
class Curmudgeon { int iErrors; }-ChrisSmith
Back to CodingConventionsQuestions
My favorite one is: D)
class Foobar { int iBla; public static void main( String args[] ) { return; } }
class Foobar { int iBla; public static void main( String args[] ) { return; } }--BillRehm
http://java.sun.com:81/docs/codeconv/html/CodeConventionsTOC.doc.html
-- AveryRegier
The idea is that, to scan code rapidly, line count is less relevant than contrast. Whether that's true probably depends on how many lines you can comfortably accomodate on your screen and in your brain, which in turn depends on eyesight, fatigue, short term memory, and other human factors. I've got 20/15 eyes and edit in 80 line windows so I don't give a toss for conserving lines. To pick operators and terminators out of a (C) style format is, for me, a great deal more trouble than any line-conservation is worth.
Historically I trace (D) to the wonderful early 80's Tim Long AUUG C formatting standard, but you'll also see (D) in the most popular C++ standard, the Ellemtel standard, and in HenricsonAndNyquist's latest and greatest, the superb IndustrialStrengthC++. (C) and (A) derive from wretched typesetting in the otherwise mind-blowingly good old KernighanAndRitchie C reference book.
Given that our ilk spend half our waking lives staring at sourcecode, I agree with Bill, a PrettyPrinter is the way to go here. Interfaces should adapt to users, not the other way round. -- PeterMerel.
[To elaborate on PeterMerel above] Personally, I feel that with a PrettyPrinter to justify all JOS Official code to any standard is good enough - it can always be adjusted later with any other PrettyPrinter. And each coder can whatever style what most asthetically pleases her, even if ObfuscatedCode is your CupOfJava :)
--MattAlbrecht 11-JUL-1998
-b OR --brackets=break Break brackets from their pre-block statements ( i.e. ANSI C, C++ style ).
if (isFoo) { bar(); } else { anotherBar(); }
-a OR --brackets=attach Attach brackets to their pre-block statements ( i.e. Java , K&R style ).
if (isFoo){ bar(); } else { anotherBar(); }
-- BrillPappin 16-JAN-1999
{ // statement... }is legal code and if the block has a control element associated with it then I would place the controle element in line with the top brace aka:
if(blah blah blah...) // controll element of new stack frame { // statement... }It seems sensible to me that the beginning '{' and end '}' of a stack frame are vertically aligned. And that everything from within the frame is indented (pictorialising moving down the stack).
Well that's my 2 penneth...
-- GarethBuxton 19-Apr-2000