Are there similar documentation generation systems like Javadoc, for C++? Javadoc produces nice output; It would be great if you could use something like it in other languages.
There are several tools that works like JavaDoc for C++ The most popular tool is probably doxygen. It can handle JavaDoc-like comments, and also several languages (e.g., C++, C, Java, Objective-C, Python, PHP, C#). It has pretty good support for tweaking the style of the HTML output using CSS (see the users list for example documentations).
Two important issues when choosing the documentation system is to make sure that it allows you to
Document the entities that you are interested in. Do you want to document the system following the code structure or according to some other module division.
Getting the output formatted as you want. It is preferable when the documentation fits in with your general project style.
Our experience with doxygen is that it is pretty easy to set up and use, and the resulting output is fairly easy to tweak. Unfortunately, doxygen is not perfect, so in some cases it is necessary to work around quirks or bugs where the doxygen parser breaks down. Be sure to inspect all of your generated documentation carefully.
You can't use javadoc specifically, but there are a couple of tools that do what you want. The one most people tend to use is Doxygen. Here are some links for Doxygen and Doc++:
Doxygen
Doc++
There's doxygen that supports a lot of things (and more) Doxygen
There is also qdoc for QT based C++ projects. http://doc-snapshot.qt-project.org/qdoc
I'm just starting to use Sphinx for my Python projects. Its home page states "C/C++ is already supported as well".
It uses a lightweight markup called "reStructuredText".
I've just started using it for my Python projects, and like the look of the output very much.
From the Standardese home page:
Standardese aims to be a nextgen Doxygen.
It consists of two parts: a library and a tool.
The library aims at becoming the documentation frontend
that can be easily extended and customized. It parses C++
code with the help of libclang and provides access to it.
The tool drives the library to generate documentation
for user-specified files. It supports a couple of output
formats including Markdown and HTML as well as
experimental Latex and Man pages.
The Standardese code repository
also points to some blog posts:
Standardese - a (work-in-progress) nextgen Doxygen
Standardese documentation generator version 0.1
Standardese documentation generator version 0.2: Entity linking, index generation & more
Standardese documentation generator version 0.3: Groups, inline documentation, template mode & more
Standardese Documentation Generator: Post Mortem and My Open-Source Future
Related
Question pretty much explains it all. I've been wondering why Java has nice, organized and centralized API documentation, but C++ library definitions seem to be scattered across the internet?
Is it because Sun put some effort behind making Java API documentation easy and accessible? Thanks in advance.
What you call "nice, organized/centralized, API" for Java is probably the documentation of Oracles's official implementation. C++ implementations also have their own documentation, for instance, GNU's implementation is well documented in http://www.gnu.org/s/libc/manual/ (the C part), and in http://gcc.gnu.org/onlinedocs/libstdc++/ (the C++ part; see section "API and Source Documentation"). You will also be able to find in MSDN Library the full documentation for Microsoft's C++ implementation.
You probably find Java API more concise and well documented because there is only one serious implementation of it (Oracle's original implementation), making its documentation the very resource for the language itself.
On the other hand, C++ is a standard, implemented by a wide variety of vendors, and many documentation resources are not even based on any specific implementation, but in the standard itself. In the end, different C++ resources on the Internet tend to outstand others in some areas. For instance, cplusplus.com concentrate good documentation about <iostream>, <string> and beginners topics, while the documentation of SGI's implementation of STL (http://www.sgi.com/tech/stl/) became the reference resource for STL, probably because of its completeness and very good organization.
C++ has a language specification, and a set of standard libraries.
Java also has a language specification, and also has set of standard libraries.
I don't really see any fundamental difference between the C++ standards and the Java standards, except that Java also comes with a standard implementation (from Oracle, formerly Sun).
PS:
Admittedly, Java has a standard API for GUI's (Swing), and C++ doesn't. But do you really want to force a "standard" like Windows MFC, to the exclusion of alteratives like Qt?
Part of the difference comes from the fact that the C++ standard library is not as well defined as the Java equivalent. The C++ standard leaves a lot of room for implementations to behave slightly differently in certain cases, a luxury Java does not provide. So for Java, once you have one good, quality set of docs, you're done... everything you need to know is right there. But with C++, STLPort's documentation won't necessarily match Dinkumware's, for instance, and you end up with lots of scattered documentation.
One reason is that C++ is not tied to single vendor, so it's not centralized by default.
Another reason is that Java provided documenting comments as part of the language and Javadoc was available from the beginning as one of the standard JDK tools. This had an impact on availability of API docs. Generating API doc was always a natural stage in Java build model.
C++ is a different story. I have met following comment by Nathan Myers in GCC's basic_string.h implementation.
Documentation? What's that?
Only recently Doxygen established a de facto standard. For a long time documenting comment was like black magic. Each project relied on its own tools and even though some projects had very nice docs, those tools were not available for a general use. I remember people begging Trolltech to release Qt documenting tool but this never happened.
Accidentally stepped into this answer and realized it needs an update. In a meantime Qt Company has actually released QDoc. Moral: never say never.
I've been using ZPT in python recently and I love the templating language. I was looking for something similar for Java but couldn't really find anything I liked as well. The closest thing is FreeMarker.
The problem with FreeMarker and the other Java template engines I looked at was their JSP style syntax that allows for non-conforming XML. I was just wondering if there was a Java template engine that is similar to Zope Page Templates such that it's an "attribute" language that requires valid xml.
I think think there quite some of the template engines your looking for:
Cambridge
Thymeleaf
JTP (dead - but exact implementation)
javaTAL (dead - but exact implementation)
Other approaches supporting valid html are:
Snippetory (Not bound to html)
Lift (scala)
FreeMarker has a nasty dependency on AWT. It makes it impossible to use with things like Google App Engine.
I prefer to use StringTemplate for all my Java templating needs. It is the only Java based template system that strictly separates the logic from the template.
StringTemplate is a java template engine (with ports for C#, Python,
Ruby, and Scala) for generating source code, web pages, emails, or any
other formatted text output. StringTemplate is particularly good at
multi-targeted code generators, multiple site skins, and
internationalization/localization
Its distinguishing characteristic is that it strictly enforces
model-view separation unlike other engines. Strict separation makes
websites and code generators more flexible and maintainable; it also
provides an excellent defense against malicious template authors.
Since you are generating XML
Another solution that isn't obvious at first sight is using JAXB. We have a project here that requires us to generate XML, we have very well defined XSD files for the output files, building the objects and marshalling them is super easy and very painless.
The java template engine you will find to be most similar to Chameleon is Thymeleaf.
There is Distal for client based templating.
There are currently two tal implementations for Java that I know of:
Java ZPT
JPT
There is also Apache Velocity. Although it doesn't require that your templates be valid XML. That may be a deal breaker for you given the question. You could likely enforce that rule with extensions to the core classes though.
What about GXP?
There's also LSP and xtempore.
I have a DSL which is based on a custom metamodel, which in its turn is based on EMF/Ecore. I am trying to figure out which solution to choose, and I cant find any decent comparisons anywhere.
Does anyone have any reasons why I should choose one over the other?
What I know so far is that Acceleo uses a OMG standardized language, but it seems harder to use than Xpand.
First of all, I wonder why you consider Acceleo more difficult to learn than Xpand, while both languages have differences (blocks and delimiters for example) they have quite a similar structure. I won't details all the elements in both languages but, for example, I don't see such a difference between something like:
«FOREACH myAttributes AS a»«a.name»«ENDFOREACH»
and
[for (a: Attribute|myAttributes)][a.name/][/for]
Both are template based languages and as such they have quite the same structure. The main difference between Acceleo and Xpand comes from the fact that Acceleo is based on the standards MOFM2T and OCL from the OMG and the tooling.
I am not very familiar with Xpand tooling but you can find more about it on their wiki. Acceleo on the other side contains an editor with syntax highlighting, code completion, error detection, refactoring and more. It also contains a debugger, a profiler, Ant and Maven support. You can also easily deploy your generators as Eclipse plugin for other users or use them out of Eclipse in a regular Java application. You can find more information on Acceleo here. You can see in videos most of the features of Acceleo on the Obeo Network (registration required).
Finally, the latest activity on xPand as occurred a year ago while Acceleo is actively developed. You can even follow the Acceleo development on github if you want.
Stephane Begaudeau
Disclaimer: I am one of the member of the Acceleo dev' team.
I am a dabbler, not an expert.
My impression is that if you need little more than a templating language, then Xpand is the way to go. Otherwise, pick Acceleo - but as you say, the learning curve is very steep.
When do you need more than a templating language? For me, they seem to run out of gas when the structure (not content) of the output is dependent on multiple independent pieces of the input. If you don't want to get into Acceleo, but have one of these cases, consider inventing an auto-generated "shim" language that gets you partway from input language to output language, perhaps with a lot of redundancy in it to avoid lookups at template-generation time.
I've been using the old 2.x Acceleo on a full scalled project and done some test with the new one.
The langage is pretty easy to use, but with the new version it's a little bit more difficult to bind some
java code to your template when the script langage is not enought.
I was a very big fan of the 2.x, but with the 3.x, I add lots of troubles to make it work. You have to write java code to handle eclipse resources for instance. I totaly gave up when updating to juno, my acceleo projects didn't worked anymore and I didn't manage to correct it in two days. I hope they will make it easier to use out of the box.
Basically the main difference is that ACCELEO is an implementation of the MOF Models To Text Transformation Language which is the OMG (Object Management Group) Standard for the definition of Models to Text transformation. It is therefore a standard language designed by the same group ho designed MOF, UML, SysML and MDA in general. XPAnd is a language which I guess existed before the standard but it is now different from it.
If you start from scratch then start with Acceleo.
In my case, I use a custom meta-model (derived from UML2) with custom stereotypes and stereotypes properties). I tried both Acceleo and Xpand template languages. Indeed they are pretty similar in term of structure and capabilities.
However, I can see one big difference (which makes Xpand much better in this use case): you can use your custom stereotypes in your Xpand templates.
Xpand engine brilliantly chooses the "best matching template/rule" for every stereotype (taking into account inheritance between stereotypes as well).
Furthermore, it is very easy to obtain stereotype properties.
These two "features" make the templates very elegant, compact and readable.
For example:
«DEFINE myTemplate FOR MyUmlProfile::MyStereoType»
MyValue: «this.myStereotypeProperty» or simply: «myStereotypeProperty»
«ENDDEFINE»
In Acceleo, I found it clumsy to achieve the same (longer statements, more code) and my templates ended up lengthy and complex. The positive thing about Acceleo, however, was that it worked conveniently from IBM RSA (applied directly to RSA (emx) models). It has code highlighting and auto-complete working nicely.
Xpand only worked if I exported my RSA models to ".uml" (~XML) format. It doesn't offer code highlighting or auto-complete (or at least I didn't figure out how).
Considering all pros and cons, I still vote for Xpand (in my use case).
Is there any free decent program to do code documentation for java?It's hard enough to get the coding project done and then need to spend time writing documentation as well.If you know, please tell me.
javadoc is the standard tool (included with the JDK) for Java source code documentation.
The standard Java API documentation has been generated with javadoc.
Well,
definitely there is javadoc. I think it is by far the most used tool for documenting java projects. Also, take into account that not only documents the methods and the classes but also you can document/create tutorials with static html pages and they'll appear in the generated documentation.
All the most popular IDEs (Eclipse, NetBeans for example) would generate the javadocs for you. It would list all the parameter, thrown exceptions etc. For obvious-purpose methods like getters and setters it will also generate good enough comments (getX() "Gets x" etc.). What you'll need to do than is to complete the javadoc comments for the classes and methods that are more sophisticated than getters, setters or default constructors.
There is also plenty of plugins (for Eclipse see here) that you can use for example to generate UML diagrams to illustrate your code structure.
Javadoc (as noted) is the standard tool for Java. However you may want to check out Doxygen, which will provide more powerful code navigation features and rendering options.
Automatically generated documentation sucks. Why have it? it doesn't add any value.
For years (more than a decade) I am using TallTree's DocJet (http://www.talltree.com/) to generate technical documentation from my Java/C++ code with very satisfactory results. The tool does not require any special tags (although it understands javadoc tags); it sufficient to describe class/method/field in plain English with occasional wording such as 'return' (or any other expression with the same meaning), "parameter" or "argument" and so on.
I'm looking for a tool that will reverse engineer Java into a sequence diagram BUT also provides the ability to filter out calls to certain libraries.
For example, the Netbeans IDE does a fantastic job of this but it includes all calls to String or Integer which clutter up the diagram to the point it is unusable.
Any help is greatly appreciated!!!!!!!
I think jtracert is what you are looking for. It generates a sequence diagram from a running Java program. Also, because its output is a text description of the diagram (in the formats of several popular SD tools), you can use grep to filter for only the classes you are interested in.
I believe the perfect tool to solve your problem is Diver: Dynamic Interactive Views For Reverse Engineering. It provides both static and dynamic sequence diagrams and looks to solve all your requirements from your question.
It is a plugin for Eclipse and lets you:
Easily trace your Java programs
Visualize your program’s runtime functionality
Filter your traces to make them more compact
Filter your IDE based on what occurs at runtime
See what code ran in your source code editors
It's on Github and there is also a project web site
Full Disclosure: I am the current project lead for Diver
Try MaintainJ. MaintainJ generates sequence diagrams at runtime for a use case. It provides multiple ways to filter out unwanted calls. Yes, filtering out unwanted calls is the most important feature needed in sequence diagram generating tools. Besides, MaintainJ provides a neat interface to explore the diagram and search for calls in one use case or across use cases.
Check the demo video to get a quick overview.
I am the author of MaintainJ, by the way.
JTracert is now discontinued. In place, they recommend http://www.jsonde.com/
I have a tool that meets your requirements exactly. Check it out
http://sourceforge.net/projects/javacalltracer/
In addition to being a reverse engineering tool for java it is also very lightweight. You can control the what you want to record from your java program.
Enterprise architect from Sparx claims to be able to reverse engineer java code including generating sequence diagrams - see this section of the user guide
It looks like it can record a debugging session and then you generate the sequence diagram from that
I've not tried it (though have used EA as a modelling tool) so ymmv!
There is a free 30day evaluation download available
Take a look at http://www.maintainj.com
It don't know, whether it can filter library calls, but it has a reasonable graphical front end and seems to trace even very large applications.
MaintainJ is really wonderful tool, Recently i was started to use with MaintainJ with my application it is giving more comfort with my entire usage to understand my system based on Maintainj sequence & UML diagrams.
I am sure for the above question MaintainJ is will give better idea.
Thanks,
Krishna MM
I have just started using the sequence diagram recording feature in Sparx Systems Enterprise Architect. It works very well for C#. You can create filters by class and by method. I'm actually trying to find out if it's possible to filter out an entire package. There is a checkbox for automatically excluding external modules (like the .NET Framework) which aids in declutter. YMMV for Java, but I think their support (and documentation) for Java is generally better (more examples) than for .NET.
Heatlamp (http://www.jmolly.com/heatlamp/) was designed for exactly this purpose.
It generates interactive (and printable) diagrams from running Java code. You can specify filters to describe which classes, packages, and methods to trace. You can also search, filter, and collapse invocations after the diagram is rendered to further reduce the sequence diagram.
Disclaimer: I'm the author of Heatlamp.
This looks like a really nice tool:
http://www.architexa.com/learn-more/sequence-diagrams
But it looks like it's only free for a year, then its $250 a year. Bummer.
I found the ModelGoon plugin to be helpful. It's a bit limited because you choose a single method as the starting point for the sequence diagram, and it only shows the calls that method makes (so to go a level deeper you need to generate another diagram.)
http://www.modelgoon.org/?page_id=53
JIVE (www.cse.buffalo.edu/jive) will construct a sequence diagram from the execution of a Java program. It has an Exclusion Filter capability will allow you to exclude objects belonging to designated classes or packages. JIVE can draw sequence diagrams for multi-threaded Java program execution. It also has the ability compact large diagrams in both the horizontal and vertical dimension, under user guidance.
Here's and add-on to Asgeir's answer. Here's the link that I found.
http://www.java2s.com/Code/Jar/s/sequence.htm
Run from the command line ... "java -jar sequence.jar" ... this is a Java application with a GUI.
The help section says:
SEQUENCE is a program for producing UML Sequence Diagrams. In contrast to most similar programs you don't actually draw the diagram. Instead you write a textual description of the method calls you want to diagram and the layout is calculated and drawn automatically.
So this tool doesn't reverse engineer anything, but I can see how it might be helpful if you wanted to quickly diagram things from scratch. Looks like it was built in 2002 and I think there are probably better tools out there now.
Here's another similar tool here:
http://sdedit.sourceforge.net/example/index.html