Fixing EBN isues.

Study has started again, which means that my attention is (slowly) shifting from KDE hacking to all kind of study related things. Which is not that bad as I have some quite interesting courses (information security, advanced c++ programming and computer vision). Normally this means for me that I don’t have time (but more, no energy) to do very much KDE hacking. However I found some task which can be done relative easily in between. Bringing down EBN  issues. I have worked out a lot of issues in KPilot already and currently I’m giving a stab at KMail.

While it might seem very dull, which it is in some sense, it is also very satisfying. Not in the first place to see the numbers going down on EBN itself ;) . But when working on the issues you also see code transforming, becoming more uniform and in some cases more readable. I don’t know what it is but I just enjoy seeing beautiful code. (Might be due to the book Google send me this summer, and by hanging out too much with [ade] in the past).

One of the things I noted in KMail (but I’ve seen this also in KPilot) is a quite inconsistent use of header inclusion. This happens in two areas. The first is that in some header files no forward declarations are used even when that is possible (when only pointers or references of that type are declared).


#include <QtModule/QClass>

class MyClass {
QCLass *mVariable;
void method( const QClass& c );

The second thing is that the include lists are a real mess in some files. Sometimes even k includes and Q includes are mixed up. What I would like to see is having a preferred order for includes in each file. Let’s say: own headers, project headers, k headers, q headers and other headers. And the next thing I’d like to see would be to have the includes sorted alphabetically. These are in fact relatively small changes but I think most of the headers and cpp files can be designed to look that way. This really would make it easier for (new) developers to see in a glance which classes/methods are actually used and also to see if the class he wants to used is included already. Another little annoyance I did see was mixing up (between files): #include KMyClass and #include "kmyclass.h". I guess most of these things are not new for the readers of my blog and still we (including myself) make really a mess of things so now and then =:).
This wasn’t meant as some rant on the kmail coding style or something. Just wanted to share some thought about this in general. Please let me know if you have some useful comment on this subject. Currently there is unfortunately not a check for unneeded includes in headers in krazy, but this would be very nice. If you have perl skills please give winterz a hand on this. p.s. Even this can snoop a lot of time which should be spend on my study =:S. p.p.s. If you find issues in KMail due to EBN Fixes I did, please drop me a mail at: [b DOT broeksema AT home DOT nl] and I’ll try to fix or revert the change if necessary. p.p.p.s. The line edits in KMail will soon have that cool clear button….

This entry was posted in coding and tagged , , . Bookmark the permalink.

Comments are closed.