• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Coding standards

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I wanted to find a coding standard document for Java, servlet, jsp, jsf... programing. Does Sun maintains this document any where in their site? Any one of you please let me know.

Thanks
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following URL will help you

Java Coding Conventions


sat
 
Marshal
Posts: 79412
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another set of standards here. Note:
  • There are differences from Sun.
  • This second link is much more restrictive about some things.
  • The Sun conventions were last updated about 10 years ago, and there are some things which have gone out of date. There is something where it says "like *** if Java had ***s", but I have forgotten the full details.
  •  
    Ranch Hand
    Posts: 327
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for the links, our coding in standards are due for an update as well, so I'll put these to good use.

    Although i think that tabs are the only acceptable form of indentation.....

    J.
     
    Ranch Hand
    Posts: 31
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Although i think that tabs are the only acceptable form of indentation.....



    Until someone else's IDE has tabs set to a different width than yours.

    You threw down a gaunlet in one of the many programming religious wars!

    alan
     
    Sheriff
    Posts: 22785
    131
    Eclipse IDE Spring VI Editor Chrome Java Windows
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Alan Hampson wrote:

    Although i think that tabs are the only acceptable form of indentation.....



    Until someone else's IDE has tabs set to a different width than yours.

    You threw down a gaunlet in one of the many programming religious wars!

    alan


    If you only use tabs then at least the indenting will be consistent. The worst type of indentation is a mix of spaces and tabs. That's why I always tell my tools to convert new tabs to spaces.
     
    Jason Irwin
    Ranch Hand
    Posts: 327
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Rob Prime wrote:
    If you only use tabs then at least the indenting will be consistent. The worst type of indentation is a mix of spaces and tabs. That's why I always tell my tools to convert new tabs to spaces.


    Agreed, mixing is where the mess lies and bad indentation can throw you for a loop at times (well...15 seconds, maybe. If you've not had enough coffee and it's a slow day).

    With tabbing enforced as the only acceptable form of indentation, each developer can set the indentation size to what they prefer and not impose their choice on others. Tab indented code is also smaller (less characters) and thus more efficient to move into/out of source control and push across the network. People who use spaces are simply bloating the text file and killing the planet. Won't they think of the polar bears?

    People who insist on using spaces after being repeatedly told that tabs are the only acceptable form should, of course, be strapped to a bench and flayed until they repent their sins.

    Religious war? Where?

    (In reality I'm not that cut up about it, so long as the team is consistent)
     
    Author
    Posts: 12617
    IntelliJ IDE Ruby
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    That only works in environments that are intelligent enough to have variable-sized tabs when lining up non-tab-aligned lines. It also requires that *every* tool used to view source code (a) have that ability, and (b) be configured for the project's tab size, but only when viewing that project's artifacts.
    reply
      Bookmark Topic Watch Topic
    • New Topic