\flushleft


\section{Code conventions}

\begin{verbatim}
func(x, y) {
   ...
}
\end{verbatim}

The indent size is one tab-stop for each level of indenting.

\rule{\textwidth}{0.1mm}

\begin{verbatim}
if (number == 2) {
   ...
}


if ( <komplexExpression> ) {
   ...
}
else {
   ...
}

while (n < 30) {
   fooBar(n++);
}
\end{verbatim}

Note the convention on function naming and the presence of curly brackets
even though there is only one line of code. else always start on it's
own line.

\rule{\textwidth}{0.1mm}

\begin{verbatim}
switch (currentToken) 
{
   case 1: 
   {
      ...  
   break;
   }
   ...
}
\end{verbatim}

\rule{\textwidth}{0.1mm}

\begin{verbatim}
class Foo 
{
public:
   void aFunction();

protected:
   int someData;
   void anotherFunction();
     
private:
   char someMoreData;
   void yetAnotherFunction(data);
};


Foo *bar = new Foo();
\end{verbatim}

\begin{itemize}
\item All variables are private or protected; private is preferred. 
\item All functions should be private or protected if possible. 
\end{itemize}
\rule{\textwidth}{0.1mm}

\begin{verbatim}
//animation.cpp

#include "animation.h"

#include "foofile.h"
...

#include <barfile.h>
...

\end{verbatim}

\rule{\textwidth}{0.1mm}

Other notes:

\begin{itemize}
\item Variables with a long lifetime and large scope such as private variables
have long descriptive names such as motionPictureHashMap 
\item Variables with a shorter lifetime and smaller scope such as lokal
or parameter variables have shorter names such as pictureMap 
\item Loop and short lived test variables have names consisting of one character
such as i, j or n. 
\item Constants (const) are named in capital letters with an underscore
between each word: IMPORTANT\_CONSTANT. 
\end{itemize}

