Welcome to xMule: A P2P Client derived from eMule BerliOS Developer LogoSourceForge.net Logo


Links
- Visit the Forums!
- SF.net Project Page
- xMule Screenshots

Modules
· Home
· Content
· Downloads
· Recommend Us
· Search
· Statistics
· Top
· Topics
· Your Account

Who's Online
There are currently, 2 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here

 
The Great Refactor Coding Blog: The Great Refactor: Step 4: Make Heavy Use of Forward Declarations
Posted by HopeSeekr on Friday, August 20 @ 15:52:48 CDT
Contributed by HopeSeekr

Now that we have sufficiently plotted the dependencies of objects via header documentation (1, 2) we can now get to the Good Stuff (TM): Heavy use of Foward Declarations...

Briefly Forward Declarations are used by elite hackers instead of #includes wherever possible, especially in header files. Forward Declarations
• Require only 4 bytes of storage (or the size of a memory address) irregardless of the real size of the object (decreased memory).
• Do not need to 'know' the details of their declarations (decreased compile time).
• Are independent of their definitions (decreased possibility for errors + extensibility).
• Useful for circular dependencies (where foo requires bar requires foo). • Greatly-increased encapsulation (greater over-all program security).
• Far less explicit code in the application (increased code optimization).
The simple fact is, headers are not always needed. You should use Forward Declarations instead of headers if the following are true
• The object is stored as a pointer. • The module does not require run-time specific details of the object (its functions, internal variables, etc). Since they can only work when you do not need to know the details of the object's declaration, Forward Declarations are most often used in header files. Because of my recent work revolved around plotting the modular interdependencies (via documenting headers), I can now fairly easily create Forward Declarations wherever possible. Doing so to the extreme, and then restructuring xMule itself to allow for ever-greater numbers of Forward Declarations stands to increase the efficiency of xMule in the numerous domains already cited. If you want to help in this endeavor, be sure to get in touch with me either via email or IRC. Cheers,
-hope Start time: 14:48 CDT on 20 August 2004.
FileUnneeded headersTime Processed AddFriend.h1 out of 114:48


 
Login
Nickname

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Related Links
· More about The Great Refactor
· News by HopeSeekr


Most read story about The Great Refactor:
Our Situation


Article Rating
Average Score: 3
Votes: 2


Please take a second and vote for this article:

Excellent
Very Good
Good
Regular
Bad


Options

 Printer Friendly Printer Friendly


"The Great Refactor: Step 4: Make Heavy Use of Forward Declarations" | Login/Create an Account | 1 comment | Search Discussion
The comments are owned by the poster. We aren't responsible for their content.

No Comments Allowed for Anonymous, please register

Re: The Great Refactor: Step 4: Make Heavy Use of Forward Declarations (Score: 0)
by Anonymous on Tuesday, August 24 @ 09:03:46 CDT
Great work Hope!, I cant wait for a new release that fixes that anoying segfault.
Cheers ;)
Alex suse9.1





PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL.
PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.07 Seconds