Warning, /education/labplot/src/doc/api_design.dox is written in an unsupported language. File is not indexed.

0001 /**\page api_design API design guide
0002 
0003 \section header Header files
0004 
0005 Try to reduce as much as possible the number of includes in header files. This will generally help reduce the compilation time, especially for developers when just one header has been modified.
0006 It may also avoid errors that can be caused by conflicts between headers. Most of the time, forward declarations are sufficient.
0007 In MyClass.cpp, the first include should be MyClass.h. This ensures that MyClass.h is standalone.
0008 
0009 \section naming Naming schemes
0010 
0011 Names of classes with pure virtual methods, and of classes whose instances are not usable (e.g., because of virtual methods with a do-nothing implementation, one or more of which are expected to be reimplemented in subclasses), are prefixed with the string ?Abstract?.
0012 Names of classes providing a primary view on an Aspect, and other classes providing the view part of a model/view construct, are suffixed with 'View'.
0013 Methods that return a 'count' value, i.e. the number of objects of some kind, use the singular form for the object name, suffixed with 'Count'. Example: columnCount().
0014 
0015 \section mistakes Avoiding common mistakes
0016 
0017     Avoid large, cryptic constructors in favour of sensible defaults plus setter methods. Example (from [http://doc.trolltech.com/qq/qq13-apis.html Designing Qt-Style C++ APIs]):
0018 @code
0019     QSlider *slider = new QSlider(12, 18, 3, 13, Qt::Vertical, 0, "volume");
0020 @endcode
0021     is much harder to understand for someone reading the code than
0022 @code
0023     QSlider *slider = new QSlider(Qt::Vertical);
0024     slider->setRange(12, 18);
0025     slider->setPageStep(3);
0026     slider->setValue(13);
0027     slider->setObjectName("volume");
0028 @endcode
0029     Avoid boolean function parameters. It's often hard to figure out what such a function call does without referring to the API documentation every time. Replacements can be either two distinct methods or flags, depending on the details of the problem. Example:
0030 @code
0031     aspect->children(true, true)
0032 @endcode
0033     would be mucher harder to read than
0034 @code
0035     aspect->children(AbstractAspect::IncludeHidden | AbstractAspect::Recursive).
0036 @endcode
0037     Also, this allows you to add more flags later on without breaking binary compatibility, so it can be a good idea even if you only have a single flag for now. Using QFlags is recommended in order to make flags type safe, and because it adds implicit documentation to the API (particularly useful when using an
0038     IDE with code completion).
0039     Except for basic types, parameters should be passed by const reference. This avoids copying the object. Returning references is not a good idea in most cases, because the referenced object changes when calling the method again. Example:
0040 @code
0041     QString myMethod(const QString &string, int number);
0042 @endcode
0043 */