Documentation Javadocs. Design/Documentation An essential ingredient of good Object Oriented programming is known as design by contract. This means that.

Slides:



Advertisements
Similar presentations
Lilian Blot Announcements Teaching Evaluation Form week 9 practical session Formative Assessment week 10 during usual practical sessions group 1 Friday.
Advertisements

Design By Contract Using JMSAssert.
Chapter 1 Object-Oriented Concepts. A class consists of variables called fields together with functions called methods that act on those fields.
CS0007: Introduction to Computer Programming Methods: Documentation, Reference Parameters, Modularization 2.
Utilities (Part 3) Implementing static features 1.
16-Jun-15 javadoc. 2 Javadoc placement javadoc comments begin with /** and end with */ In a javadoc comment, a * at the beginning of the line is not part.
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
Object-Oriented Enterprise Application Development Javadoc Last Updated: 06/30/2001.
1 More on Arrays Arrays of objects Command line arguments The ArrayList class Javadoc Review Lecture 8 notes and L&L 7.1 – 7.2 Reading for this lecture:
Applying OO Concepts Using Java. In this class, we will cover: Overriding a method Overloading a method Constructors Mutator and accessor methods The.
1 Documenting with Javadoc CS 3331 Fall 2009 How to Write Doc Comments for the Javadoc TM Tool available from java.sun.com.
Apply Sub Procedures/Methods and User Defined Functions
3.1 Documentation & Java Language Elements Purpose of documentation Assist the programmer with developing the program Assist other programers who.
Javadoc. The Plan ● What is Javadoc? ● Writing Javadoc comments ● Using the Javadoc tool ● Demo ● Practice.
JavaDoc1 JavaDoc DEPARTMENT OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING CONCORDIA UNIVERSITY July 24, 2006 by Emil Vassev & Joey Paquet revision 1.2 –
11 Chapter 5 METHODS CONT’D. 22 MORE ON PASSING ARGUMENTS TO A METHOD Passing an Object Reference as an Argument to a Method Objects are passed by reference.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
Writing JavaDocs Mimi Opkins CECS 274 Copyright (c) Pearson All rights reserved.
A brief introduction to javadoc and doxygen Cont’d.
Program documentation Using the Doxygen tool Program documentation1.
Program documentation using the Javadoc tool 1 Program documentation Using the Javadoc tool.
1 Documenting with Javadoc. 2 Motivation  Why document programs? To make it easy to understand, e.g., for reuse and maintenance  What to document? Interface:
Lab 7 Queue ADT. OVERVIEW The queue is one example of a constrained linear data structure. The elements in a queue are ordered from least recently added.
Documentation and Programming Style Appendix A © 2015 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Javadoc Comments.  Java API has a documentation tool called javadoc  The javadoc tool is used on the source code embedded with javadoc-style comments.
Documentation javadoc. Documentation not a programmer's first love lives in a separate file somewhere usually a deliverable on the schedule often not.
Javadoc A very short tutorial. What is it A program that automatically generates documentation of your Java classes in a standard format For each X.java.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
CSC 212 – Data Structures Prof. Matthew Hertz WTC 207D /
Javadoc Dwight Deugo Nesa Matic
JavaDoc and Contracts Spring Documenting Contracts with JavaDoc Contract model for methods Preconditions Postconditions JavaDoc Industry standard.
Identifiers Identifiers in Java are composed of a series of letters and digits where the first character must be a letter. –Identifiers should help to.
Introduction to Classes and Objects. Real Life When a design engineer needs an electrical motor he doesn’t need to worry about –How a foundry will cast.
Javadoc. Purpose of javadoc javadoc is a program that reads your Java program and produces great-looking documentation in HTML format Without any help,
Javadoc. Purpose of javadoc  javadoc is a program that reads your Java program and produces great-looking documentation in HTML format  Without any.
Georgia Institute of Technology Creating Classes part 4 Barb Ericson Georgia Institute of Technology May 2006.
CreatingClasses-SlideShow-part41 Creating Classes part 4 Barb Ericson Georgia Institute of Technology Dec 2009.
A brief introduction to javadoc and doxygen. What’s in a program file? 1. Comments 2. Code.
Javadoc Summary. Javadoc comments Delemented by /** and */ Used to document – Classes – Methods – Fields Must be placed immediately above the feature.
Page 1 – Autumn 2009Steffen Vissing Andersen SDJ I1, Autumn 2009 Agenda: Java API Documentation Code Documenting (in javadoc format) Debugging.
Computer Science 209 Software Development Handing Errors and Creating Documentation.
1 Documenting with Javadoc CS 3331 Section and Appendix B of [Jia03] How to Write Doc Comments for the Javadoc TM Tool available from
Lecture 7 February 24, Javadoc version and author Tags These go in the comments before named classes. –Put your SS# on a separate line from the.
HTML tags and attributes By: Dennis Champagne. List of tags.
In this class, we will cover: Overriding a method Overloading a method Constructors Mutator and accessor methods The import statement and using prewritten.
The Vector Class. Vector Class Write a Vector class. This will be a container class that will hold objects. It should allow the following operations:
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
C. Thomas Wu An Intro O-O Java Programming javadoc Utility.
Winter 2006CISC121 - Prof. McLeod1 Stuff We had better discuss a midterm date… –27 Feb. to 3 March or –6 to 10 March.
1 Documenting with Javadoc How to Write Doc Comments for the Javadoc TM Tool available from java.sun.com.
Today Javadoc. Packages and static import. Viewing API source code. Upcoming Topics: –protected access modifier –Using the debugger in Eclipse –JUnit testing.
3-July-2002cse142-D2-Methods © 2002 University of Washington1 Methods CSE 142, Summer 2002 Computer Programming 1
Variable Scope & Lifetime
More on Arrays Review of Arrays of ints, doubles, chars
Advanced Programing practices
More Sophisticated Behavior
Software Development Handing Errors and Creating Documentation
PHP (PHP: Hypertext Preprocessor)
Preconditions precondition: Something your method assumes is true at the start of its execution. Often documented as a comment on the method's header:
Introduction to javadoc
Design by Contract Fall 2016 Version.
Initializing Objects.
Class Commenting Doxygen for Classes.
Documentation Comments in C#.
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
JavaDoc and Contracts Fall 2008.
Applying OO Concepts Using Java
Introduction to javadoc
Tutorial 10: Programming with javascript
Presentation transcript:

Documentation Javadocs

Design/Documentation An essential ingredient of good Object Oriented programming is known as design by contract. This means that before modules are written a specification or contract is written which states What preconditions must be met for the module to properly function What is the purpose of the module What will be the state of things after the module executes which is known as the postconditions

Example A module located in a Queue class which will dequeue the element at the head of the queue. Precondition –The queue must be instantiated. It is recommended that isEmpty be run to assure that their is an element to dequeue Purpose –Remove the element at the head of the queue and return it to the user. It will be an Object. Postcondition –The queue will have one fewer element unless the queue was empty to start with in which case the method will return null and the queue will be unchanged

Design/Documentation Java comes with an excellent documentation tool called Javadoc Usage of the Javadoc system requires following several steps First special Javadoc block comments are added to source files. Javadoc block comments start with /** and end with */ this they function like regular comments Each class, field and method should be commented with a Javadoc comment just before the actual item.

Javadoc The comment should start with a short descriptive phrase followed by a period. Then a longer description of the purpose of the item may be added. HTML may be embedded Special tags can be used The precondition and postcondition should be included.

Javadoc Once commenting is complete the Javadoc program is run from the OS prompt. If for example a group of class files for a given project are located in the same directory then Javadoc may be run by typing javadoc *.java When the program runs it will report any problems and will produce a series of HTML files documenting all classes, methods and fields. A Javadoc template is on the next slide followed by a sample

Javadoc Template /* */ /** Descriptive phrase. Longer statement of purpose. Precondition: Precondition goes here Postcondition: Postcondition goes p1 A description of this p2 A description of this return A description of the return value */ public int someMethod(double p1, String p2) { return 0; } Note: The leading comment of “---” characters is not part of the Javadoc system but will make code easier to read

Results