0% found this document useful (0 votes)
37 views

Our Recommendations For Coding Java.: Standards

The document outlines standards, styles, and conventions for coding Java. It provides 28 standards for areas like naming, formatting, and comments. It also lists 28 styles that cover code organization, indentation, braces, and other stylistic elements. Finally, it includes 22 programming conventions related to error handling, class structure, method length, and more. The goal is to promote balance, brevity, uniformity, consistency, and readability in Java code.

Uploaded by

vadivel.km1527
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Our Recommendations For Coding Java.: Standards

The document outlines standards, styles, and conventions for coding Java. It provides 28 standards for areas like naming, formatting, and comments. It also lists 28 styles that cover code organization, indentation, braces, and other stylistic elements. Finally, it includes 22 programming conventions related to error handling, class structure, method length, and more. The goal is to promote balance, brevity, uniformity, consistency, and readability in Java code.

Uploaded by

vadivel.km1527
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Our recommendations for coding Java.

Standards Styles Conventions

Java Coding Standard Principles


Balance Brevity Uniformity Consistency Readability

Standards :STD-1 :- Package naming. STD-2 :- Class and Interface naming. STD-3 :- Method naming and formatting. STD-4 :- Variable naming. STD-5 :- Constant naming. STD-6 :- Use of JavaDoc comments is required. STD-7 Use of implementation comments is required. STD-8 Consistency of formatting is required within a source file. STD-9 Avoid local declarations which obscure declarations at higher levels.

Styles
STY-1 Order sections within source files consistently. STY-2 Order of import statements. STY-3 Import statement detail. STY-4 Ordering of class parts. STY-5 Ordering of methods within classes. STY-6 Limit length of source code lines. STY-7 Line continuation of method signatures. STY-8 Line continuation of general code. STY-9 Indentation levels. STY-10 Indentation using tabs. STY-11 Indentation of controlled statements. STY-12 Brace placement. STY-13 Ternary statement usage. STY-14 Always use a break statement in each case. STY-15 Include a default case in all switch statements.

STY-16 Initialize local variables where they are declared, but only for non-default values. STY-17 Initialize members and sub-objects either in a declaration or in constructors. STY-18 When commenting out code, only use // style comments STY-19 Properly format comments. STY-20 Comments should not obscure the code STY-21 Variable declaration grouping. STY-22 Place variable declarations at the beginning of the innermost enclosing block. STY-23 Limit the number of Java statements per line to 1. STY-24 Optional braces are not optional. STY-25 Parameter naming. STY-26 Method naming for accessor methods. STY-27 Use prefixes to indicate variable scope and source. STY-28 Use blank lines to organize code blocks.

Conventions
CON-1 Protect code using try..finally. CON-2 Constructors must leave objects in a stable state. CON-3 Methods should accomplish a single task. CON-4 Limit the length of methods. CON-5 Limit the length of source files. CON-6 Limit the number of methods. CON-7 Limit the use of public methods and variables. CON-8 All class variables should be private. CON-9 Limit the number of parameters. CON-10 Avoid predefined shallow classes and methods. CON-11 Include proper content in your implementation comments. CON-12 Avoid nesting conditions more than 3 deep. CON-13 Define constants in interfaces. CON-14 Make good use of spacing. CON-15 Class methods and class variables should only be accessed via the class identifier. CON-16 Use parentheses to clarify expressions. CON-17 Identify closing braces. CON-18 Favor IsX() over getX() or hasX() for boolean functions. CON-19 Avoid sub-classing the class Error. CON-20 Distinguish between checked and unchecked exceptions. CON-21 Enhance exceptions with additional data. CON-22 Avoid dependency on side-effects.

You might also like