Graphlet Tcl Coding Standards

Naming Conventions

Use _
Use _ in names to separate words, as in
# USE this style
set this_is_the_answer 42

# NOT this style
set thisIsATheAnswer 42

This will make your program more readable.

Use namespaces
Always use Tcl namespaces; this helps to avoid collisions with other people's code.
Use long and unique names
Use long, descriptive and unique names, the longer the better. Especially global names less then 8 characters are depreciated. This is neccessary to avoid collisions with names in other modules.
Note: Graphlet uses the namespace GT and the prefix GT for global names.

Namespace names must start with a capital letter
Example: GT_Graph, GT_Tcl_Graph.
All other names must start with a lowercase letter.
Example: (from trees) father, son, next_son.

Defensive Programming

Use defensive programming whenever possible. Defensive programming means: any function must act gracefully if there is an error. For example, functions must check for empty lists.

Portability Issues

Some hints to generate portable code in Tcl:


Graphlet | Coding Standards