7

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.

Rob
  • 5,223
  • 5
  • 41
  • 62
chrislgarry
  • 616
  • 5
  • 21
  • 1
    See http://stackoverflow.com/questions/3897509/c-standard-api – DuckMaestro Nov 06 '11 at 05:15
  • C++ does have an API, but it doesn't have official API _documentation_ (at least, not as detailed and well-organized as Java's). – David Z Nov 06 '11 at 05:22
  • Thanks David. That's pretty much what I'm talking about. Just wondering why the documentation is not as good. – chrislgarry Nov 06 '11 at 05:24
  • You are not really complaining about a standard API but rather a standard set of centralized documentation. You could say that it is defined in the standard. See [here](http://stackoverflow.com/questions/81656/where-do-i-find-the-current-c-or-c-standard-documents) or a copy [here](http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2011/n3242.pdf) – Martin York Nov 06 '11 at 05:24
  • 1
    PS. I use the original C++ STL documentation a lot: http://www.sgi.com/tech/stl – Martin York Nov 06 '11 at 05:30
  • @Quicksort - It's more like Sun owning the language and not letting anyone else add to it. That makes their documentation the definitive one. – Bo Persson Nov 06 '11 at 10:50

4 Answers4

10

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.

lvella
  • 12,754
  • 11
  • 54
  • 106
3

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?

paulsm4
  • 114,292
  • 17
  • 138
  • 190
2

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.

Dennis Zickefoose
  • 10,791
  • 3
  • 29
  • 38
1

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.

mip
  • 8,355
  • 6
  • 53
  • 72