Coding Guidelines

To make the code in TAPAAL consistent between different development teams all code should following the following guidelines. All new patches to TAPAAL will be reviewed against these coding guidelines. Before submitting a patch to TAPPAL please make sure that it corresponds to the current coding guidelines.

Brackets

Start brackets are always set on the same line as the expression.

if (true) {
  //Code
} else {
  //Code
}

Brackets are always written, also when the are not needed:

Bad:

for (int i=0; i<10;i++)
  System.out.println("Hi");

Good:

for (int i=0; i<10;i++){
  System.out.println("Hi");
}

Debug output

Never use System.out.println or similar for sending debug information to the console. Always use the logging-framework (dk.aau.cs.debug.Logger)

Logger.log("This works")

Exceptions

There is a big discussion on if we use checked or unchecked exceptions. See http://www.ibm.com/developerworks/java/library/j-jtp05254.html for arguments. In TAPAAL we adopt a pragmatical approach where the programmer decides whether a exceptions in checked or uncheked, as long as he can argue for his dission.

Constructors

Always create a Constructor for a class (also the default constructor). All class should have a main constructor, call by all other constructors. The main constructor must always call super.

developer/codingguidelines.txt ยท Last modified: 2018/10/18 18:50 by kyrke
CC Attribution-Noncommercial-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0