• 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:
  • 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
  • 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>
     
     
       
     
     
       
       

 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic