Coding Guidelines

When coding for Dia, it makes life easier for everyone if we follow the same coding guidelines.  Poorly written/formatted/documented code is more likely to be returned to sender, wasting time for all parties.

Dia was not originally written with strong guidelines in mind, and it shows.  The code style varies based on programmer, task, and mood, and very little is documented.  This is not an excuse to write new code crappily. That being said, the current guidelines are out-of-date: coordination with the current maintainer to determine new guidelines is necessary before any large-scale rewriting.

The base of the previous maintainers coding guidelines are Sun's guidelines for Java, even though Dia is written in C.  Syntactically, there's enough overlap that it makes sense.  Sun's guidelines are mostly on a syntactic level; here are some highlights:

  • Never elide brackets (curly braces { }); use parentheses when any confusion is possible.
  • Always document functions and global variables.
  • Always indent four spaces and wrap nicely before 80 characters.
  • Put spaces around all operators and after keywords and separators (semicolon and comma).

Apps/Dia/CodingGuidelines (last edited 2019-09-24 15:58:51 by CalumMcConnell)