Generating API Documentation?
Preda asks: "I have been recently tasked with generating API documentation for new and legacy code. Given the amount of legacy code (in C, VB6, VB.NET, PHP, and other languages) and new code that needs to be documented, are there any easy auto generating API programs out there. I have done a few searches but nothing that I have found stood out as a 'use me' solution. Does anyone have any advice?"
Other than that, there's the Commentator...
With so many languages, I'm not sure there's any one solution that can handle all of them. And if you want good, readable documentation, you're going to have to be describing all of the functions, objects, constants, etc. in human-written prose anyway.
Why not cut down on the workload for you by setting up a documentation wiki and asking the development team to help?
MZ Tools for Visual Studio makes nice XML documentation in a large number of languages- then you only need an XSL transform to output it to a web page. I'm sure there's something similar out there for PHP- though it seems to me PHP's only real API is the CGI interface itself, which leaves you with only one interface per script.
SJW: a person who perceives an injustice, and while correcting it, commits a greater injustice.
Don't bother with autogeneration. First off- developers are far less likely to comment in wierd formats, or update comments in wierd formats (even when they do, its easy to typo and break the generator). You end up with out of date or missing documentation due to this. Secondly, for good documentation you need more than what an autogenerator can do anyway- good documentatition has examples, use cases, warnings and gotchas, etc. The old fashioned way is best- talk to the developers working on it, and write the documentation by hand.
I still have more fans than freaks. WTF is wrong with you people?
check out a tool called nDoc. It can take the /// documentation auto generated in C# (in VS 2k3), or with VBCommentor (a plug in for VB/ASP.Net 2k2 and 2k3) and build it into CHM/HTML/MSDN help files.
/// auto documentation is built into the VS.Net IDE. I managed to talk my manager into encorporating it. And we have about 75% of our library documented in API style (class definitions and descriptions, function definitions, parameters, thread saftey, namespaces, the whole gambit.) The remaining 25% is under redesign so its documentation is still in limbo. But with VBCommentor/C# /// going back to document namespaces/classes/methods/members is a brease.
Its nice since the
-Rick
"Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
I have been recently tasked with generating API documentation for new and legacy code.
This is usually what a company asks an important developer to do before they let him/her go. I hope this isn't your situation though. Hopefully they are promoting you to manager and letting you hire/train new employees (using your documented code).
Commentator. Because you _know_ the coders haven't properly commented their code.
Please correct me if I got my facts wrong.
Doxygen handles many languages, not just C++. It's a great utility and can produce some very complete "books" with introductions and full explanations. It will output in multiple formats. For the code you just add simple javadoc-style comments such as:
/**
* This is a function that does something.
*
* @param foo first argument
* @param bar second argument
*
* @return some useful value
*/
The comments have minimal markup, inside the code source, so when you edit the actual functions you can also read (and update) the comments.
I figured out that you use Visual Studio .NET since you are programming VB.NET. If that's the case just enable "Generate XML Documentation File" from project properties and use code comments to generate documentation. I'm not sure how this is done in C/VB/VB.NET but in C# you use those /// comments. When you compile your project, Visual Studio generates XML file which has all the appropriate comments in it. After this you can use NDoc to generate real documentation in CHM, HTML2 or MSDN style formats.
You don't know what you don't know.
developers are far less likely to comment in wierd formats
Natural Docs can solve problem of weird formats. It is rather straitforward, looks nice in code and very easy to use. Besides, it allows you to write docs in separate files if developers really give up commenting in code. As for me, this is the best doc autogenerator I've ever seen.
May Peace Prevail On Earth
Use, web, weave and tangle, the famous tools behind Knuth's literate programming mindset.
Instead of writing code and not commenting it, you write a book on what you want your code to do, littered with examples of how it works and justifying why, and the tools somehow produces the C files and compile the library for you.
At least its something like that, the weave documentation didn't seem clear enough at the time for me to get it to do anything useful. *cough* I needed instructions not why's and because's
However it looks like folk are doing something useful with it: http://www.ox.compsoc.net/~gemini/simons/webperl/
blog.sam.liddicott.com
Doxygen is a good tool for many languages. It works best for C++, but it also has some limited support for PHP, which is in your list of requirements. There is also a fork of Doxygen called DoxyS. It generates prettier output for C++ but may not support the other languages as well as Doxygen. Another tool inspired by Javadoc is PHPDoc for PHP code. However, it does not seem to be actively developed anymore.
For plain C code, I prefer gtk-doc, which generates better output than Doxygen (IMHO, and for C only). You can see an example of the gtk-doc output by browsing the GTK+ API documentation.
Since you also mention Visual Basic, you could have a look at VBDOX. I haven't tried it myself so I don't know if it works well. There are some screenshots on their site, so maybe you should have a look and decide if you like the results.
-Raphaël
Robodoc is similar to Doxygen but is more liberal in the languages it can recognize/work with (i.e. it does not require a C-family syntax).
http://www.xs4all.nl/~rfsber/Robo/robodoc.html
Agreed. I've used DOXYGEN, Javadoc and perldoc extensively for documentatoin. The beauty about the first two is that if your code makes sense and you haven't bothered to inline any documentation, you still end up with a 'GOOD' documentation detailing your code hierarchies, methods and accessors. That's the automagic you're after. Not sure if it'll support VB though.
- Consider
.NET Development Center. MSDN has been following this documentation presentation model for years and it proved to be quite convenient for developers. You get a hierarchical API tree on the left and documentation on the right. The documentation for API groups is clumped together with nice introductory articles etc. Unfortunately it is practically impossible to generate using Doxygen.
- Doxygen is not scalable. Period. If your source base is 10 million LOC and you change one function in one tiny file, you will have to run Doxygen on your entire source base to incorporate the change.
- Neither is Doxygen geared toward generating API manuals. This is actually the worst problem with the whole situation. I've seen projects, where people would generate Doxygen style API reference and call it "documentation." Well, just having a huge list of documented function is not documentation.
Having said that, I still think that Doxygen is the best automated documentation generator out there and I hope it'll answer all those issues in the future.As other posters have mentioned - Doxygen rocks.
Documentation, API or otherwise is not "generated", it is "written" and "maintained". Anything less is pure lazyness and virtually useless. Just print out the damn header files! It's bad enough when a known system is used and proper pre-formatted commenting is done in code, "Generating" API docs for legacy systems that don't already contain copious amounts of in-line documentation, pre-formatted for a particular parser are is utterly futile.
:(
"Software Engineering" suffers another great set-back from being a true discipline
The professional version of Doc-O-Matic supports .Net, Java, C++, Delphi, etc. It's a grand and does the same thing Doxygen does with a nice gui and super-easy customization.
LOAD "SIG",8,1
LOADING...
READY.
RUN
You're right. What sort of coder could possibly learn and understand complicated, unforgiving syntax? The human mind was just not meant for such things!
"It's Dot Com!"