cs 2112 lab javadoc and debugging
play

CS 2112 Lab: Javadoc and Debugging CS 2112 Lab: Javadoc and - PowerPoint PPT Presentation

CS 2112 Lab: Javadoc and Debugging CS 2112 Lab: Javadoc and Debugging Javadoc Overview Javadoc Overview Javadoc is a tool for creating html documentation The documentation is generated from comments It produces actual html web pages


  1. CS 2112 Lab: Javadoc and Debugging CS 2112 Lab: Javadoc and Debugging

  2. Javadoc Overview Javadoc Overview ◮ Javadoc is a tool for creating html documentation ◮ The documentation is generated from comments ◮ It produces actual html web pages ◮ Helps keep documentation consistent with the code CS 2112 Lab: Javadoc and Debugging

  3. Doc Comments Doc Comments ◮ Doc comments start with /** and end with */. ◮ The /** and */ should be on their own lines ◮ Additional lines need to start with a *. ◮ Comments can have html tags. /** 1 * This is a javadoc comment 2 */ 3 CS 2112 Lab: Javadoc and Debugging

  4. Tags Javadoc Tags ◮ Use tags to help Javadoc parse your comments. ◮ Tags start with a @ and are case sensitive. ◮ It must be at the beginning of the line /** 1 * Prints the kth element of the list 2 * 3 * @author Alexander Lee 4 * @param list The list who’s element is to be printed 5 * @param k The index of the item to be printed 6 */ 7 public void printK(List list , int k) { 8 9 } 10 CS 2112 Lab: Javadoc and Debugging

  5. Javadoc Links Javadoc Links ◮ @link package.class#member label ◮ This tag inserts a link that points to the documentation of the specified class ◮ label represents the text that shows up ◮ The curly brackets indicate that it is an inline tag ◮ So it can be placed anywhere in the comments, doesn’t have to be in the beginning. /** 1 * Get the names of an object 2 * 3 * @deprecated This function should not be used 4 * Use {@link #getFirstName ()} and 5 * {@link al91.Person#getLastName ()} instead. 6 */ 7 CS 2112 Lab: Javadoc and Debugging

  6. Javadoc Links Important Tags Some important tags ◮ @author: describes the author ◮ @param: describes a specific parameter ◮ @return: describes the return value ◮ @throws: describes exceptions it throws ◮ @deprecated: describes the reason ◮ @see package.class#member CS 2112 Lab: Javadoc and Debugging

  7. Javadoc and Eclipse Javadoc and Eclipse ◮ To generate the doc, go to Project and Generate Javadoc ◮ Eclipse automatically generates Javadoc comments if the method signature is already written. ◮ Can configure Eclipse to complain about missing Javadoc by going to preferences, compiler, javadoc CS 2112 Lab: Javadoc and Debugging

  8. Exercise Specification Exercise Design a GPS system that finds the shortest route from the current location to the destination. ◮ There are three ways of transportation, by car, by public transportation and by walking. ◮ The GPS sytem should be able to return a route given any current location, and destination ◮ Can be easily updated to add new roads, or to avoid roads CS 2112 Lab: Javadoc and Debugging

  9. Debugging Debug Exercise Run Lab02 in the debug perspective. The program currently prints out a grid of 4’s, but this is not right. Try to debug it using: ◮ breakpoints ◮ stepping over, in, out ◮ continuing ◮ inspecting variables CS 2112 Lab: Javadoc and Debugging

Recommend


More recommend