[Qt-interest] Qt coding guidelines/conventions

Brad Hards bradh at frogmouth.net
Fri Mar 26 00:52:14 CET 2010


On Thursday 25 March 2010 11:53:58 pm Mandeep Sandhu wrote:
> What coding convention/guidelines do you guys follow while writing your Qt
> apps?
I think the coding part is, in many ways, less important than the API design 
(class interfaces). I recommend reading:
http://doc.trolltech.com/qq/qq13-apis.html
(although I have to say that the talk at Akademy 2004 captured it better, so 
you might have to read it a couple of times).

That, plus doxygen, and actually writing the documentation in the code for 
doxygen to use, makes for a good, well documented API. That is the first step 
to maintainable code.

There is also much to learn from the "Refactoring" book by Martin Fowler (the 
cover is terrible, but the content is inspiring).

The other useful things are valgrind, code coverage, and tests - in 
combination. Others have mentioned valgrind, but I'd like to point out that Qt 
does come with a fairly easy-to-use test framework called QTestLib:
http://doc.qt.nokia.com/4.6/qtestlib-tutorial.html

Good luck with your travels through Qt land.

Brad



More information about the Qt-interest-old mailing list