Hi. I am planning on SCJD, and I am gathering information. My doubt is on code conventions. I am reading Sierra & Bates bonus CD material on SCJD, and one whole chapter is dedicated to coding conventions. For example, they (official Java conventions) that all local variables in a method should be separated with a blank line from the rest of the code. But, I have read on other places that it is good practise to declare variables when they are first used / necessary, which is not neccessarily at the top of the method.
The question is: how strictly should I comply with the standard conventions? I do have quite some Java experience, and my conventions are not always the same as the official ones (but very similar, with a few exceptions), but then again, I don't want to loose point on such a trivial thing. Is it really so important to use the standard conventions?
If you decide not to follow these conventions you should make that clear in your choices.txt file. People have decided to adopt the standards used
by their IDE but I am uncertain whether they have had marks deducted for this approach.
Raf Szczypiorski wrote:Thank you for your reply.
I know the link you sent me to, but I noticed one thing:
The Code Conventions for the Java Programming Language document was revised and updated on April 20, 1999.
Is anyone strictly following these? For example, in the time when 19 inches widescreen displays are pretty common, do developers still limit their code to 80 lines?
My understanding of this "recommandation" is to make sure it is nicely displayed on any OS with any tools.. By the way, I just edited a java source file in vi on Solaris ten minutes ago... it does happen..
If Java is to be executed anywhere, we should be able to read it everywhere ;) What happens If you print the code ?
Don't get me wrong, I don't personnaly care too much for the 80 characters, I just want to give you some perspective..
Anyway, you should follow it for the SCJD.. And I agree with you, I don't live and die by this rule at work..