Stendhal code design: Difference between revisions

From Arianne
Jump to navigation Jump to search
Content deleted Content added
imported>Hendrik Brummermann
imported>Hendrik Brummermann
No edit summary
Line 1: Line 1:
{{Stendhal code design}}
{{Navigation for Stendhal Top|Developing}}
{{Navigation for Stendhal Top|Developing}}
{{Navigation for Stendhal Developers}}


== Stendhal Javadoc ==
== Stendhal Javadoc ==
Line 13: Line 13:
== Coding Standards ==
== Coding Standards ==


The code is written to compile for sun java 1.5
The code is written to compile on Sun Java 1.5.


We try to follow [http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html SUN Java code convention].
We try to follow [http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html SUN Java code convention].

Revision as of 20:48, 28 February 2012

Stendhal code design


Stendhal Javadoc

The browsable javadoc is located at http://stendhalgame.org/jenkins/job/stendhal_HEAD/javadoc.

Finding your way around the Code

Coding Standards

The code is written to compile on Sun Java 1.5.

We try to follow SUN Java code convention.

Despite this:

  • We use tab for all indentation. (One tab is equivalent to 4 spaces for display purpose.)
  • We do not stick too closely to line length.
  • We always use blocks in if-statements and loops, even if the block only consists of one single statement:

if (condition) {
    method();
}

Avoid evaluation and assignment in the same line like:

  • ternary operators, for example in:
 String y = x==null ? "NULL": x.toString();
  • post-increment/decrement operators as in:
 if (idx++ == 10) {
   ...
 }