aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Coding conventions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Coding conventions" Watch "Coding conventions" New topic
Author

Coding conventions

Raf Szczypiorski
Ranch Hand

Joined: Aug 21, 2008
Posts: 383
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?
Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 163
Hi Raf

The SCJD asks you to adhere to the Code Conventions for the Java Programming language.

Code 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.

Cheers Kevin.

Java5 Tutorials | Java6 Tutorials | HTML/CSS Tutorials | JavaScript and jQuery Tutorials
Raf Szczypiorski
Ranch Hand

Joined: Aug 21, 2008
Posts: 383
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?
Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 163
I went through all my code and restricted each line to 80 chars which makes some lines less readable and isn't what I would do professionally. I
just did this for the SCJD exam.
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
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..

Regards,
Alex
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Coding conventions
 
Similar Threads
Is Javaranch Coding Standard applicable for SCJD ?
Java Conventions for Naming Swing Instances and Interfaces?
boolean rules for JavaBeans
best practice in naming convention in java programming
Code Formatting Question