• Post Reply Bookmark Topic Watch 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This page was migrated from a javaranch.com.jsp

 
   
   
   Java Programming Style Guide
   
 







1 - Formatting





1.2 - Spacing

All identifiers are surrounded with whitespace.

<em>Reasoning: Some utilities will cleanly select an identifier when you
double click on it. Some of these double-click-functions are strictly space delimited,
so any surrounding characters might accidentally get included in an otherwise
clean selection. Therefore, whitespaces (spaces and newlines) are required around
all identifiers.</em>





The only time this can become a problem is with the loss of clarity in
compound boolean analysis:





Rather






There are a few exceptions to this rule:




 
   <th>Exception</th><th>Reasoning</th><th>Examples (Do)</th><th>Bad Examples (Don't)</th>
 
   
     method names
     <em>Tradition calls for all method names to be immediately followed by a left
     parenthesis</em>
     
       
     
     
     
     
   
   
     array dereferences
     <em>Tradition calls for all array dereferences to be
     immediately followed by a left square bracket.</em>
     
       
     
     
       
     
   
   
     pre- and post-increment and decrement operators
     
       <em>Tradition calls for the unary operator to be immediately preceded or followed by the operand.</em>
     
     
       
     
     
       
       

 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic