Code Conventions

  • Indentation - We use four spaces as the unit of indentation.
  • Use spaces instead of tabs - Configure your editor to use space characters for indentations, not the "tab" character. The tab character often takes the space of either 8 or 4 characters, and this will create discrepancy in the way your code shows in different environment. The gain in file size we would get by using tab characters instead of spaces is not worth the trouble.
  • Follow the Java Convention for Java - We roughly follow the Code Conventions for the Java Programming Language. There is much to be gained by following everywhere the same convention, and there isn't much to be gained by trying to "improve" on what is standard.
  • Use an encoding-aware editor - This is important for XML files. Some files start with XML declaration such as <?xml version="1.0" encoding="windows-1252"?>. If your editor does not recognize this, special characters might get incorrectly saved when you change files. If your editor doesn't recognize the XML encoding declaration, you might want to use an editor specifically designed to support XML documents.
Comments