Comments
Patrick Collands wrote: collands (AT) gmail com I'd be very grateful for an invitation. Thank you.
Cloud Expo on Google News

SYS-CON.TV

2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Click For 2008 West
Event Webcasts
Java Developer's Journal: "@ See Javadoc"
@ see Javadoc

My dear wife has just started to learn to use Java in her work and asks me a lot of questions as she begins her journey in this wonderful language. To almost all her questions my answer is the same: "See Javadoc."

In addition to being a way of avoiding having to find or know the answer, it constantly surprises me what is available in the Javadoc and how useful a source of information it can be.

When I began to use Java in 1998 I received the pointer of the Java API Specification, or Javadoc, from a colleague. Despite the limitations of the JDK 1.1 Javadoc style when compared to Java 2, I immediately found that it was much more helpful than my other reference books. The books might help you get started on Java but, once you're serious, the Javadoc is something I know I can't live without.

The obvious benefit of using Javadoc is getting the most accurate and detailed description of Java APIs. Most likely the Javadoc is written by Java API implementers who know the behavior of the API inside-out. When the API changes, so does the Javadoc, whereas books, tutorials, and other sources lag behind. To know how a mehod works, asks the author who committed the doc and code together.

To ensure that different vendors' Java implementations uphold Java's fundamental tenant of "write once, run anywhere," Javadoc plays a part too. For any implementation to claim that it is compatible to a certain Java specification, it must pass the conformance test suite, sometimes called Technology Compatibility Kit (TCK). Each test in the TCK is strictly written according to the Javadoc, and nothing else, to make sure that the behavior of an implementation conforms. So if your application relies solely on behaviors described in Javadoc, you not only leverage the TCK effort but also have the maximum assurance that the application will work across different Java implementations. On the other hand, un-Javadoc'ed behaviors are likely implementation dependent and subject to change in future releases. If your application relies on any of these, the guarantee of "write once, run everywhere" may no longer hold.

Javadoc is a "living" document, as it is continuously being updated and maintained. At Sun, a lot of change requests of Javadoc are filed by development teams and customers during the development of a new release of a Java technology. These include requests for API semantic changes, behavior clarifications, or are as simple as grammar or spelling corrections. Regardless of how trivial it is, each change request to Javadoc is treated seriously. Some of them have to go through thorough reviews and approvals. Each new release of a Java technology is often accompanied by hundreds of Javadoc improvements, so by using Javadoc you leverage all these efforts.

Today's Javadoc is more complete than ever. The String.substring() story is just one example, but if you have other questions, such as "What is the behavior of this method if the parameter is null?" or "Does this method throw IllegalArgumentException or IndexOutOfBoundException if the index is invalid?", take a look at the Javadoc and seek the answers there.

Javadoc is by no means perfect. You may find that an API's description lacks certain aspects or is not clear enough. Should you feel that way, the developer who implements this API may have felt the same and chosen his own interpretation in the API's implementation. The result is different behaviors across different implementations. It is important therefore that, as an API consumer, you file Javadoc change requests at http://bugs.sun.com/services/bugreport/index.jsp. Remember, a more precise and definitive Javadoc will result in more conformant Java implementations, which in turn increase the chance that your applications can run across different platforms.

So what can you do with Javadoc? See it, rely on it, and improve it.

About Xiaozhong Wang
Xiaozhong Wang is a software engineer at Sun where he has solved some security problems in his TCK (Technology Compatibility Kit) work.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

The article has a typo on the name 'mehod' (in the last sentence of the 3rd paragraph), it should be 'method'.

Java Developer's Journal: "@ See Javadoc" My dear wife has just started to learn to use Java in her work and asks me a lot of questions as she begins her journey in this wonderful language. To almost all her questions my answer is the same: 'See Javadoc.'


Your Feedback
Wyatt Wong wrote: The article has a typo on the name 'mehod' (in the last sentence of the 3rd paragraph), it should be 'method'.
Java Developer's Journal News Desk wrote: Java Developer's Journal: "@ See Javadoc" My dear wife has just started to learn to use Java in her work and asks me a lot of questions as she begins her journey in this wonderful language. To almost all her questions my answer is the same: 'See Javadoc.'
Latest Cloud Developer Stories
CloudBench Applications, Inc. announced its financial results for the three months and nine months ending September 30, 2009. All amounts are stated in Canadian dollars unless otherwise noted. Revenues from BasicGov, the Company's cloud computing solution for local government, gr...
The new contract is an industry first, with CSC being the first Microsoft partner to lead and win a cloud computing services agreement of this scale. Under terms of the contract, CSC will provide Royal Mail Group's 30,000 employees with access to new IT services using Microsoft's...
Operates in over 170 countries and is one of the world’s leading providers of communications solutions and services. Richard Tarboton talks for MeettheBoss.TV on his role as Head of Energy & Carbon for BT and what they are doing towards reducing carbon emissions.
CA is going to put its Agile Planner software on salesforce.com’s Force.com platform in the first half to accelerate development time and give users visibility over their development initiatives to reduce time-to-market. Customers are supposed to be able to accelerate the deploym...
Despite its uncertain fate Sun soldiers on. Monday it trotted out a cloud-based multiplatform desktop as a service for K-12 and community colleges that can run Windows, the Mac OS, Linux and Solaris applications to nearly any client device, including its own Sun Ray thin clients....
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers
ADS BY GOOGLE

Breaking Cloud Computing News
CloudBench Applications, Inc. announced its financial results for the three months and nine months e...