...would be a
verbose and better API-Documentation.
There is a big code-documentation-lazyness within the complete API-Documentation:
Most methods are explained very poorely, I guess the author "hacks" some functions into CS and maybe he writes a demoprogram or assumes that all other programmers in the world know what he knows.
Every time I read the API, I think that the author thought "My style is clearly enough, it doesn't need some time-wasting, lame documentation.
Writing some doxygen lines is really too exhausting."
Writing what a method does, what it's parameters are and what the method returns is very important to know - in complete sentences and no reduced short form.
Some bad examples:
virtual bool csEvent::Add ( const char * name,
iBase * v
) [virtual]
Implements iEvent.
Wow, that's really useless. I can add a name. What should it look like? Where do I need it? What is "v"? So I'm going to surf around within the API and search for more information and in the worst case I don't find any.
There are more examples that are even worse, because there is no documentation (or just something like "Document me!@@.") the identifiers' names are unusable for guessing what their use could be ("o", "v", ...), ....
Another example:
virtual void iJob::Run ( ) [pure virtual]
Do stuff.
"Do stuff". Yeah. Dance the monkey shuffle? Delete my files? Or just "for(;;);"?
OK, now I'll tell you how to greatly improve the API-Docs:
1) Some hyperlinks would be good:
virtual csFlags& iPortal::GetFlags ( ) [pure virtual]
Set portal flags (see CS_PORTAL_XXX values).
"CS_PORTAL_XXX"? Hmm, *seeearch*
2) The API-Docs are really lame with the current settings, I change the .dox-files and compile it by my own since two years.
The Java-API is a good example how a documentation could be, I don't know how to code efficiently with less than that.
(
http://java.sun.com/j2se/1.5.0/docs/api/index.html)
You can get something like this with doxygen too. It's a mighty tool, but you don't use it.
Use
Treeview,
Searchengine,
Dot, let doxygen
sort the methods, ... and the API-Website becomes usable.
Check it out:
http://www.stack.nl/~dimitri/doxygen/config.html- Treeview really helps with the navigation. Someone postet a wiki-comment to the online docs some time ago. He asked if there will come content. I bet, with treeview he had instantly seen everything.
- The Searchengine shortens the time I need to search and it searches every place in the API. More time and less stress for me.
- Sorting... many methods currently are not sorted, that costs time. Please... Sorting is the very most important feature at all! I can't believe it's disabled.
- Dot... I can see which class inherits/implements what, I see UML-diagrams from that class, I can click on that diagram and browse to dependant classes and more. That's really useful.
3) Please throw away that
stylesheet, it's ok but far away from best-readable. The default-stylesheet from doxygen 1.4.x has a much better layout and better colors, it's really charming.
4) Please change your documentation-style (when you have one :-P), it's lazy, it's short, there is no difference to "no documentation at all" (see examples above).
I write large documentations even for methods that every idiot might understand:
/**
* This method sets/changes the name of the player.
* \param name This is the name, the player should get. It may have any length and unicode-chars too.
* \return true when setting/changing the name was successfull
* \return false when setting/changing the name was not successfull
*/
bool Player::setName(csString name);
I guess the CS-version would be:
/**
* Sets the players name
*/
bool Player::setName(csString name);
or
/**
* Sets the players name
* \param name The name.
*/
bool Player::setName(csString name);
I know, you will say "that is too much work", CS has hundreds of methods.
Right, it's too much work
now, but there are four steps to polish the complete reference without many stress:
1) every new method will get it's documentation en passant: Write the method and
instantly documentate it. You don't have to do it later. And you should not do it later, because you forgot something or even think about the next two functions -> the docs are bad-style again
2) Whenever someone opens an old file to read/debug some existing code: documentate it/extend the docs from that method or the whole class.
3) Use grep to find all those "Document me!@@" and fix them first. Doxygen will think that this is a documentation and so it will not print warnings!
4) let doxygen write warnings into a file, read the warnings from that file and eliminate them. Step by step.
1)+2) may cost 1 - 10 minutes per method, but that doesn't hurt. In this time you can relax from coding and even think about what you've coded and if the code really does what the docs say.
3)+4) is more work, but with a good style this will be reduced to zero
Please, please, please, please do it and all programmers out there will worship you; yet they just curse you ;-)
Please, please, please, please, please. *conjure* *beg on my knees* *bow*