Help us document C++ headers!
Date: Tuesday, June 22 @ 22:53:13 CDT
Topic: Volunteer


One of the main necessities in order to have a maintainable application the size of xMule is minimal module interdependency. And xMule (like its parent, eMule, and child, aMule) is *severely* coupled. Help solve this problem in a critical way by helping us document header inclusions.... The Process has already begun...

The only way we can even begin tackling the monster called Decoupling, we *must* figure out at a minimum why each header is needed wherever it is included in the application. Thus we turn relatively unfriendly header statements like #include "xmule.h" into the much more hospitable form of #include "xmule.h" // Needed for theApp This needs to be done for *every* #included file *every*where*. Fortunately it is easy and fun to do :-) Here is a real-world example using AddFileThread.cpp from CVS. Step 1: Comment out a #include statement. //#include "xmule.h" Step 2: Compile xMule. xmule/] $ make Step 3: Find out why the header is needed, if it is. Compiling AddFileThread.cpp... AddFileThread.cpp: In member function `virtual void* CAddFileThread::Entry()': AddFileThread.cpp:93: error: `theApp' undeclared (first use this function) Step 4: Log the first dependency. #include "xmule.h" // Needed for theApp Step 5: Make a patch and send to Ted. xmule/] $ cvs diff -u > AddFileThread.patch There only a few coding guidelines for this task:
  • Use // not /* */ for commenting headers.
  • Use *spaces* NOT tabs
  • Start the // at column 41, as this allows us to see the comment on a screen with resolution 1024 or better, and we can align the header comments.
  • A really nice editor, and one that all the developers of xMule use, is Vim and its GUI front-end GVim. If you choose to use this wonderful editor, my personal .vimrc is all you will need to be sure that you use spaces instead of tabs, and that vim behaves 'properly'. Simply put the vimrc as ~/.vimrc. Finally, look here to Learn vim in 15 minutes, a wonderful Quick Start Vim guide. As usual, I am available for your support in these and other endeavors either via IRC at #xmule on Undernet or via email at hopeseekr at xmule dot ws. Cheers,
    - hope

    This task was completed by HopeSeekr



    This article comes from xMule: A P2P Client derived from eMule
    http://www.xmule.ws/phpnuke

    The URL for this story is:
    http://www.xmule.ws/phpnuke/modules.php?name=News&file=article&sid=16