1 / 12

Appendix A

Appendix A. Coding Conventions. Comments. Single line - //Here is a comment Multi-line - /* This is a multi-line comment */ Documentation comment - /** This is a documentation comment used by Javadoc */. Naming Conventions. Class – mixed case with words capitalized CyberPet TextField

raoul
Download Presentation

Appendix A

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. Appendix A Coding Conventions William H. Bowers – whb108@psu.edu

  2. Comments • Single line - //Here is a comment • Multi-line - /* This is a multi-linecomment */ • Documentation comment - /** This is a documentation comment used by Javadoc */ William H. Bowers – whb108@psu.edu

  3. Naming Conventions • Class – mixed case with words capitalized • CyberPet • TextField • Interfaces – same as class, many interface names end with ‘able’ • Drawable • ActionListener William H. Bowers – whb108@psu.edu

  4. Naming Conventions • Method – verbs in mixed case with first letter lowercase • actionPerformed() • sleep() • insertAtFront() William H. Bowers – whb108@psu.edu

  5. Naming Conventions • Instance Variables – same as method names, should be descriptive and indicate data type • iMaxWidth • bIsVisible • fArea William H. Bowers – whb108@psu.edu

  6. Naming Conventions • Constants – uppercase with internal words separated by underscore, prefix with data type • iMAX_LENGTH • dTAX_RATE William H. Bowers – whb108@psu.edu

  7. Naming Conventions • Loop or temporary variables – may be single letter, preferred to name as Instance Variables • x, y, z • iRow • iColumn William H. Bowers – whb108@psu.edu

  8. Braces • Begin and end of block • Ending brace should have comment • Indent and align Public void sayHello() { System.out.println(“Hello”); } // end of method sayHello William H. Bowers – whb108@psu.edu

  9. Code Structure • Program header • Program/file name • Author • Date • Description • Modification log William H. Bowers – whb108@psu.edu

  10. Code Structure • Import statements • Class header • Constants • Variables William H. Bowers – whb108@psu.edu

  11. Code Structure • Methods • Method headers • Inputs • Outputs • Description • Notes William H. Bowers – whb108@psu.edu

  12. Questions & Discussion William H. Bowers – whb108@psu.edu

More Related