The "Coding Standards" is an interesting issue in it's own right - I am tempted to start a new thread just to talk about it. On second thoughts, no - someone else's turn to start theoretical topics if they want to.
"One good thing about music - when it hits, you feel no pain" <P>Bob Marley
"One good thing about music - when it hits, you feel no pain" <P>Bob Marley
Originally posted by Michael Fitzmaurice:
I see
So, Mark, what made you switch to end of line (I assume this is what you now use)?
[ October 10, 2003: Message edited by: Michael Fitzmaurice ]
Another aspect of making the assessor’s life easier is what you’ll learn in Chapters 11 and 12. The little things really matter! For example, while you might think—if you indent your code four spaces—that an occasional three-space indentation here and there is OK, what’s the harm in that? The harm is in readability, and while a couple of inconsistencies in indentations might not be a big deal, adhering to the Java Coding Conventions is absolutely crucial for others looking at your code…
especially the assessor.
We’ve seen people fail the exam because they put the curly braces on the line below the method declaration rather than immediately following the declaration (on the same line), violating the official Java Coding Conventions. While this infraction alone probably might not cause you to fail, the points deducted for code convention violations might be the ones that sink you where you otherwise might have squeaked by. You don’t get to make very many mistakes in this exam. Just because your manager or your co-workers are tolerant of a little sloppiness here and there, the assessor won’t be.
SCJP, SCJD, SCEA 5 "Any sufficiently analyzed magic is indistinguishable from science!" Agatha Heterodyne (Girl Genius)
"One good thing about music - when it hits, you feel no pain" <P>Bob Marley
I think that makes a pretty strong statement about following Sun's standards.
"One good thing about music - when it hits, you feel no pain" <P>Bob Marley
"I'm not back." - Bill Harding, Twister
Michael I was quite surprised to see that Sun actually include [style of braces] in their standard, given its contentious nature.
Michael I have absolutely no intention of getting into a religious war about whether end of line is better than next line (especially since I suspect next liners like me are a minority on this one...)
Come to think of it, I wonder if the examiner runs your code through something similar to CheckStyle, in order to see how closely you adhere to the standard? It seems fairly likely.
Jim I don't know if they actually do still take off points
Jim And I'd have no problem with them taking off points for having an inconsistent coding style.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Tony Morris
Java Q&A (FAQ, Trivia)
Andrew This way you can stop all arguments: if the company you are working for has standardised on the Sun style, then it is explicit where the braces go.
"One good thing about music - when it hits, you feel no pain" <P>Bob Marley
"I'm not back." - Bill Harding, Twister
and any experienced developer is smart enough to know that forcing coding standards such as these causes more harm than good.
SCJP 1.4, SCJD 1.4, SCWCD 1.3, SCBCD 1.3, IBM Certified Solution Developer -WebSphere Studio V5.0
4 - Indentation
Four spaces should be used as the unit of indentation. The exact construction of the indentation (spaces vs. tabs) is unspecifed. Tabs must be set exactly every 8 spaces (not 4).
Do I just stick to spaces?
SCJP,SCJD,SCWCD,SCBCD,SCDJWS,SCEA
"I'm not back." - Bill Harding, Twister
That new kid is a freak. Show him this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|