The coding style used will be similar to Vala itself[1] (which in turn is similar to gtk+) to keep consistency.

  • Tabs rather than spaces.
  • Tab width unspecified, but 4 works well.
  • Hanging braces:
  • Cuddled else.
  • Braces not necessary for single-line blocks.
  • Variable and method identifiers in lowercase, words seperated by underscores.
  • Type identifiers in CamelCase.
  • Enum members and constants in ALL_CAPS, words seperated by underscores.
  • C-style /* comments. */
  • Hungarian notation not used.
  • Variables often declared without type (i.e. "var").
  • No line-length limit.
  • Function-length limit of two screens - lets keep them small and readable.
  • Space between method name and parameters' opening parenthesis.
  • Property "get", "set", "default" declaration all on one line, seperated by semicolons, if default implementations are used.
  • If properties have implementations, then "get {", "set {" open new lines.
  • Attributes on their own line.
  • using prefixes (for example Gtk.Window) and no using;
  • this. when it's unclear where an object comes from.
  • Header at top of file contains:
/* filename.vala                    *                            * Copyright (C) 20yy-20yy  Copyright Holder <email@address>              *              * License text.                   *                        * Author:                       *     Programmer Name <programmer@email>         */

Parentheses Style Edit

Leave space between function/class declarations/calls and the parentheses

public void hello ()
hello ();