documentation javadoc. documentation not a programmer's first love lives in a separate file...
TRANSCRIPT
![Page 1: Documentation javadoc. Documentation not a programmer's first love lives in a separate file somewhere usually a deliverable on the schedule often not](https://reader036.vdocument.in/reader036/viewer/2022082818/56649f1b5503460f94c308c7/html5/thumbnails/1.jpg)
Documentation
javadoc
![Page 2: Documentation javadoc. Documentation not a programmer's first love lives in a separate file somewhere usually a deliverable on the schedule often not](https://reader036.vdocument.in/reader036/viewer/2022082818/56649f1b5503460f94c308c7/html5/thumbnails/2.jpg)
Documentation
• not a programmer's first love
• lives in a separate file somewhere
• usually a deliverable on the schedule
• often not updated when program is changed
• incorrect documentation is arguably worse than none
![Page 3: Documentation javadoc. Documentation not a programmer's first love lives in a separate file somewhere usually a deliverable on the schedule often not](https://reader036.vdocument.in/reader036/viewer/2022082818/56649f1b5503460f94c308c7/html5/thumbnails/3.jpg)
Javadoc
• API documentation is included in the source code as comments
• the javadoc program will analyze the source code and produce formatted html documentation
• same style as Java Runtime Library documentation
• hopefully, programmers will update documentation when they change the code
![Page 4: Documentation javadoc. Documentation not a programmer's first love lives in a separate file somewhere usually a deliverable on the schedule often not](https://reader036.vdocument.in/reader036/viewer/2022082818/56649f1b5503460f94c308c7/html5/thumbnails/4.jpg)
Javadoc Comment Format• block comments introduced with /**
• may include html formatting tags
• placed immediately ahead of class or method definition
• class documentation/**
* Represents a <i>student</i> at a
* university.
* @author Bill
* @version 1.2
*/
public class Student {
![Page 5: Documentation javadoc. Documentation not a programmer's first love lives in a separate file somewhere usually a deliverable on the schedule often not](https://reader036.vdocument.in/reader036/viewer/2022082818/56649f1b5503460f94c308c7/html5/thumbnails/5.jpg)
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> * @throws IllegalArgumentException if * <i>grade</i> is > 4.0 */public double addGrade(double grade, int credits) throws IllegalArgumentException {
![Page 6: Documentation javadoc. Documentation not a programmer's first love lives in a separate file somewhere usually a deliverable on the schedule often not](https://reader036.vdocument.in/reader036/viewer/2022082818/56649f1b5503460f94c308c7/html5/thumbnails/6.jpg)
![Page 7: Documentation javadoc. Documentation not a programmer's first love lives in a separate file somewhere usually a deliverable on the schedule often not](https://reader036.vdocument.in/reader036/viewer/2022082818/56649f1b5503460f94c308c7/html5/thumbnails/7.jpg)
![Page 8: Documentation javadoc. Documentation not a programmer's first love lives in a separate file somewhere usually a deliverable on the schedule often not](https://reader036.vdocument.in/reader036/viewer/2022082818/56649f1b5503460f94c308c7/html5/thumbnails/8.jpg)
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
![Page 9: Documentation javadoc. Documentation not a programmer's first love lives in a separate file somewhere usually a deliverable on the schedule often not](https://reader036.vdocument.in/reader036/viewer/2022082818/56649f1b5503460f94c308c7/html5/thumbnails/9.jpg)
What To Document• javadoc is for API (application program interface)
documentation
• describe what the class/method does, not implementation details
• document all public elements
• any element that shows up in javadoc output should be documented
• to avoid documenting the default constructor:// to avoid javadoc genetation
private Student(){}