Development Guide

Naming

  • All names should be in English. Use descriptive names (except loop variables). The name of a function, method or variable should make clear what it does or stands for. Suffixes are sometimes useful: Max to mean the maximum value something can have, Cnt to mean the current count of a running count variable etc. So are Prefixes like get when a value is to be retrieved or set to set a value.

  • Naming variables: Use all lower case. If a variable name consists of more than one word use underlines. Example: $num_elements.

  • Naming functions: use all lower case. If a function name consists of more than one word use firstLetterOfWordIsLowercase style. Example: getData().

  • Naming static methods: use the static keyword to declare static methods.

  • Naming classes: all class names should start with "il", for the rest of the class name use FirstLetterOfWordIsCapitalized style, example: ilObjUser. All user interface classes should end with the suffix "GUI", e.g. ilObjUserGUI. There should only be on class per file. The corresponding file should be named class.<class_name>.php, e.g. class.ilObjUserGUI.php.

  • Naming files

    • Class files should start with a prefix "class.", end with the suffix ".php" and provide the class name in between, e.g. class.ilObjUserGUI.php.
    • Template files should be all lower case, words separated by "_", starting with "tpl." and ending with ".html", e.g. "tpl.user_list.html".