





























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Lecture from Object Oriented Programming and Data Structures course with following key points: Coding and Documenting, Designing and Writing a Program, Coding Stage, Java Api to Advantage, Design-Code-Debug Cycle, Divide and Conquer, Documentation is Code, Javadoc, Identify the Operations, Avoid Duplication, Observer Pattern
Typology: Slides
1 / 37
This page cannot be seen from the preview
Don't miss anything!






























Break program into manageable parts that can be implemented, tested in isolation Define interfaces for parts to talk to each other – develop contracts (preconditions, postconditions) Make sure contracts are obeyed Clients use interfaces correctly Implementers implement interfaces correctly (test!) Key: good interface documentation
Work in pairs Pilot/copilot pilot codes, copilot watches and makes suggestions pilot must convince copilot that code works take turns Or: work independently on different parts after deciding on an interface frequent design review each programmer must convince the other reduces debugging time Test everything
@return description Use to describe the return value of the method, if any E.g., @return the sum of the two intervals @param parameter-name description Describes the parameters of the method E.g., @param i the other interval @author name @deprecated reason @see package.class#member {@code expression } Puts expression in code font
Code and specs have a target audience the programmers who will maintain and use it Code and specs should be written With enough documented detail so they can understand it While avoiding spelling out the obvious Try it out on the audience when possible design reviews before coding code reviews
Don’t try to document with variable names Longer is not necessarily better int searchForElement( int[] array_of_elements_to_search, int element_to_look_for); int search(int[] a, int x); Names should be short but suggestive Local variable names should be short