1 / 9

Javadoc

Javadoc. CSCI 142. Documentation. Not a programmer's first love Usually lives in a separate file somewhere Often a deliverable on the schedule Not updated when program is changed Incorrect documentation may be worse than none. Javadoc.

tiger
Télécharger la présentation

Javadoc

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Javadoc CSCI 142

  2. Documentation • Not a programmer's first love • Usually lives in a separate file somewhere • Often a deliverable on the schedule • Not updated when program is changed • Incorrect documentation may be worse than none

  3. Javadoc • API documentation is included in the source code as comments • The javadoc program analyzes the source code and produce formatted html documentation • Same style as Standard API documentation • Hopefully, programmers update documentation when they change the code

  4. Javadoc Comments • Block comments introduced with /** and end with */ • May include html formatting tags • Placed immediately ahead of public class and method definitions • Document all public elements • Describe what the class/method does, not implementation details

  5. Class Documentation • @author tag for programmer name • @version tag for program version /** * Represents a <i>student</i> at a * university. * @author Bill * @version 1.2 */ public class Student {

  6. Method Documentation • up to first period included in method summary • everything included in detail documentation • @param tag to describe each parameter • @return tag if not void • tags go after text, do not specify data type /** * Adds a course grade to the student's record. * Updates both <i>gpa</i> and <i>credits</i>. * @param grade the course grade * @param credits the course credits * @return the new <i>gpa</i> */ public double addGrade(double grade, int credits) {

  7. To Run Javadoc • at the DOS prompt: • javadoc -version -author -public Student.java • creates numerous html files: • Student.java allclasses-noframe.html • constant-values.html index.html • overview-tree.html packages.html • index-all.html Student.html • deprecated-list.html package-list • allclasses-frame.html help-doc.html • on-line documentation for javadoc: • http://java.sun.com/j2se/1.4/docs/tooldocs/win32/javadoc.html

More Related