source: JEM-EUSO/esaf_lal/tags/v1_r0/esafdoc/DevelopersGuide/CodingConventions.tex @ 117

Last change on this file since 117 was 117, checked in by moretto, 11 years ago

ESAF version compilable on mac OS

File size: 4.9 KB
Line 
1%------------------------------------------------------------------------------
2\section{Introduction}
3%------------------------------------------------------------------------------
4
5This guide is miles away from to be complete and exhaustive. But \ESAF{} developers team is getting bigger and bigger and I hope that an even small reference guide dedicated to the developers may be useful to avoid painful debugging and long and sometimes ``hot'' mail exchanges.
6
7This first version of this guide would like to cover several aspects related with the classes \ESAF{} is founded on.
8
9%------------------------------------------------------------------------------
10\section{Text formatting}
11%------------------------------------------------------------------------------
12
13Indentation: 4 spaces, no tabs.
14
15%------------------------------------------------------------------------------
16\subsection{Configuring VIM}
17%------------------------------------------------------------------------------
18
19Add to your \code{~/.vimrc} the following lines:
20
21\begin{displaycode}
22set shiftwidth=4
23set softtabstop=4
24set tabstop=4
25set expandtab
26\end{displaycode}
27
28to tell VIm to use the correct indentation.
29
30%------------------------------------------------------------------------------
31\subsection{Configuring Emacs}
32%------------------------------------------------------------------------------
33Add to your \code{~/.emacsrc} the following line:
34
35\begin{displaycode}
36(setq c-basic-offset 4)
37\end{displaycode}
38
39
40%------------------------------------------------------------------------------
41\section{Coding Conventions}
42%------------------------------------------------------------------------------
43
44\ESAF{} follows \ROOT{}/Taligent name convention. Due to historical reasons there some exceptions exists.
45Class names don't begin with a T and a restricted number of them begins with E.
46
47The following paragraph is part of Addison-Wesley's \textsl{Taligent Guide} \cite{bib:taligent}.
48
49\begin{quote}
50Select C++ identifiers (including types, functions, and classes) carefully. When a programmer sees a name, it might be out of context; choose names to enhance readability and comprehension. A name that seems cute or easy to type can cause trouble to someone trying to decipher code. Remember, code is read many more times than it is written; err on the side of long, readable names. Internal code names should not appear anywhere in the interfaces to the system. Even inside your implementation, it's better to use the prosaic form if there is one.
51
52
53To make the scope of names explicit, Taligent uses the conventions of table \ref{tab:conv}.
54
55In any name that contains more than one word, the first word follows the convention for the type of the name, and subsequent words follow with the first letter of each word capitalized, such as TTextBase. Do not use underscores except for \code{\#define} symbols.
56\end{quote}
57
58\begin{table*}[ht!]
59        \centering\footnotesize
60                \begin{tabular}{|l>{\raggedright}p{140pt}l|}
61                \hline &&\\[-2mm]
62                        \textbf{\small Identifier}& \textbf{\small Convention}              & \textbf{\small Example}\\[5mm]
63                                Types                   & Begin with a capital letter             & Boolean \\
64%                               Base classes            & Begin with T                            & TContainerView\\
65%             Mixin classes             & Begin with M                            & \\
66%see "Multiple inheritance" on page 44  MPrintable
67        Enumeration types       & Begin with E                            & EFreezeLevel\\
68        %Raw C types    Avoid using C types; see "Avoid raw C types with dimensions" on page 66         
69%             Virtual base classes    & Begin with V, rather than T or M        & VBaseClass\\
70              Members                 & Begin with f for field1;                & \\
71                                                                                            & functions begin with a capital letter     & fViewList, DrawSelf() \\
72              Static variables        & Begin with g; applies to static variables in functions and global variables (excluding static data members of a class) & gDeviceList\\
73              Static data members     & Begin with fg; includes class globals   & TView::fgTokenClient\\
74              Locals and parameters   & Begin with a word whose initial letter is lowercase; local automatic variables only, treat statics like globals & seed, port, \mbox{theCurrentArea}\\
75              Constants               & Begin with k; including names of enumeration constants and constant statics &   kMenuCommand\\
76              Acronyms                & All uppercase                           & TNBPName,\\ &&not TNbpName\\
77        Template arguments      &       Begin with A                            & AType\\
78              Getters and setters     & Begin with Set..., Get..., or Is... (Boolean); use sparingly &  SetLast(), GetNext(), IsDone()\\
79              Allocator and adopters  & Begin with Create..., Copy..., Adopt..., or Orphan...; &CreateName()\\
80              \hline
81                \end{tabular}
82                \caption{\textsl{Taligent} conventions used in \ESAF{}}
83          \label{tab:conv}
84
85\end{table*}
Note: See TracBrowser for help on using the repository browser.