Tuesday, July 15, 2008

Doxygen - Yet another technical wonder

I am sure every programmer will agree with me when I say each line of code requires proper documentation. I have felt this innumerable number of times when trying to understand different code-bases, either at work or that of open source projects.

Recently I was in need of this documentation very badly. More than documentation I needed to have overview of the classes in the particular code I was looking at. Basically I was lacking an IDE and hence I was looking for some tool to give me a list of public members, private members, data & methods and several such things for a class defined in an organized and categorized manner. I looked for a light IDE and fake IDE (like Notepad++, which just lists the functions defined) and others, but none fit my needs. It was at this time that timelyx (in #foxymonkies) suggested doxygen. I had heard my tech lead at NI talking about this doxygen to be used for generating documentation for several code bases there. At that time I thought it was a tool that generates huge amounts of data of which a small part is useful and is actually read by others (users mainly). But I was totally wrong. Doxygen can really do wonders. And the best part is that it comes with a neat installer which will put the necessary components in the required locations. Then all that you need is your source (in this case the C++ header file containing the definition for the class). Run the doxygen wizard, select what all needs to be generated and provide the source file. In less than a minute you have huge set (huge considering that input is just one C++ header file with a class definition) of files generated in a folder. To simplify things there is one index.html generated. Open that up and you will be amazed at the way things are presented to you. There are tabs for different classes involved, different type of members and all that. Everything is so fabulously linked and presented. You can just get almost every detail about the class and what type of members it has, what do functions return and what they expect. Just everything and all that in one single webpage.

I am now a big fan of doxygen. It is indeed "Oxygen for docs". Go ahead and try it out. It is available here.

Happy doxygening. :-)

--Brahmana.

3 comments:

  1. I had experienced earlier, all these features provided by doxygen in Eclipse CDT(Heavy weight) .Cool! now i get the same effect in the Doxygen(light weight) that to in the format in html!!

    ReplyDelete
  2. Yes, Light is the keyword. Moreover you do not have to do any setting work as you might need in IDEs. And its not just HTML, there are options for rtf and XML also. If you have properly configured your drawing tool - dot - then you can even get various UML diagrams.

    ReplyDelete
  3. I installed the graphviz tool (drawing tool for graphs).I then ran my source code using doxygen ,Its just really unbelievanble !!! , Awesome tool .I had took very long to document the code (Inheritance diagrams , callgraph , Class hierarchy), it did all these in just 15 min !!Its really a great technical innovation

    ReplyDelete