Here are a few pointers regarding coding standards in KPhotoAlbum. Please do stick to them, so the code is easier to get into for new people, and easier to maintain for everyone.
- Indentation is 4 spaces
- Instance variables are prefixed either with an underscore or m_. Please stick to one of the two for a given class.
- Methods that are overriden from a superclass should be marked with the macro OVERRIDE. This macro expands to nothing, so it is purely for bringing to peoples attention that this is actually overriding a method.
- KPhotoAlbum is warning free zone. Please keep it that way. No warnings during compilations are accepted.
Include files and forward declarations
To speed up compilation and make things easier to understand, you should be careful about what you include, and when cleaning up code, please check whether you need all the include files.
In header files you should try hard to see if you really need an include file at all, or whether you can get by with only a forward declaration.
A forward declaration looks like:
class MyClass;
namespace MyNameSpace { class MyClass; }
You can get by with only a forward declaration when all you do is one of these:
- declare a method that passes a pointer or reference as argument (doSomething( const MyClass& )
- return an object from a method (MyClass getClass() )
- you only have the class in a container (QList<MyClass>)
In contrast you do need the include files when:
- you declare a method that takes a value argument (doSomething( MyClass cls) )
- you have an instance variable of the given class (MyClass _class).