Programming GuidelinesHow to make sure your app fits right in |
|
|
Table of Contents
Document your classes easily: use KDOCKDOC is the KDE defacto standard application for generating documentation for classes directly from their source code. It's very easy to do and many sections of the KDE already use it (including libkde and kfm). Its output is very similar to that of the documentation of Qt and also allows referencing of Qt classes and methods.Class source documentation formatting rulesThis is the javadoc style of formatting:
// The carriage return after the "/**" is required by javadoc, though
// DOC++ handles it's absence ok.
/**
* This is my class. It is a very simple class.
*
* This is the documentation for my class. . Notice that there
* is nothing between this documentation section and the declaration for
* the class.
*
* @short This is the short description for my class
* @author My Name (any string)
* @version 0.1alpha (any string)
* @see anotherClass#anotherMethod
*/
class MyClass : public MyBaseClass
{
public:
// an empty doc tag.
/**
*/
void myMethod();
// a method with more fleshed out documentation
/**
* I am a documented method.
* Build your own class documentation today.
*
* Since these sentences are separated from the rest by atleast
* one blank line, this will be a paragraph by itself.
*
* @see anotherClass#someOtherMethod
* @see aThirdClass
*
* @return a cute value
* @param parA A parameter that isnt used.
* @param parB Another parameter.
*/
int myCuteMethod( int parA, const char *parB );
};
That should get you started, hopefully. Both DOC++ and kdoc allow you to embed HTML or LaTeX into the documentation but this is not normally a good idea as it limits you to a single format of output. Be careful to make sure that you do not put in structural HTML tags like <HTML> in your documentation; remember that it will be parsed as HTML and may come out all wrong! More info on the javadoc source documentation format is available at http://java.sun.com/products/jdk/javadoc/writingdoccomments.html User lower case filenamesTry to use lower-case filenames for all your source files. This makes it easier for other developers to remember what source files to look for when they debug, modify or include your code.The class naming conventionThe KDE class naming convention, as decided, is:Don't hardcode paths..not into your makefiles... and especially not into your source. Use theKApplication directory accessors in your source
and the KDE File System Standard.
... QString icondir = kapp->kde_icondir(); ...
Remember our commitment to network transparencyWe plan to dominate the world using all sorts of lowdown tactics and cunning tricks, one of which is transparent access to network resources. It's a little tricky to program this into your apps yet, but the source for programs like kedit are good starters to understanding how this can be done with kfm's nice async network-transparent IO library. Learn to be a master to kioslave! (see the Dealing with Network Resources tutorial). |
|
Written and maintained by:
Sirtaj S. Kang
(taj@kde.org)
Last modified: Mon Jan 24 15:00:48 EST 2000 |
|