Tuesday, May 31, 2011

Doxygen: Automatically Generated Documentation

I find that automatically generated documentation is a great way to explore an existing code-base.

Specifically, the documentation produced by Doxygen (www.doxygen.org/index.html) is very helpful.  Even better, Doxygen has support for a large number of languages and producing HTML, LaTeX, and man page documentation.  Here's an example (from http://www.scfbm.org/) of a Doxygen-generated UML class diagram:




Adding meta-information to the source code is as simple as documenting it via the prescribed documentation format.  For example, Doxygen reads Javadoc-style comments:

/**
 * A String representation of an object suitable for debugging.
 */
public String toString() {
...

It's also worthwhile to look at the tags (e.g., "@todo") that Doxygen supports for the language that you're using.

Doxygen uses a configuration file, or Doxyfile to determine the type and style of documentation to produce.  I find that the easiest way to get started is by using Doxygen's GUI configuration file wizard: doxywizard

I highly recommend enabling the advanced features in "Expert" mode under the "Dot" topic for:
  • Class Diagrams,
  • Collaboration Graph,
  • UML Look,
  • Include/Included-by Graph,
  • Call/Caller Graph, and
  • Graphical Hierarchy.
Also in "Expert" mode, enable the "Source Browser."  It helps to do fast-pased IDE-style code traversal while you familiarize yourself with the code-base.

No comments:

Post a Comment