Computer Science 15-100 (Sections T & U), Fall 2007
Class Notes, Day 5:   Tue 11-Sep-2007


Logistics

  1. Schedule
  2. Reading for next lecture

Topic Outline:

  1. Hw2.java
     
  2. BasicGraphics.java  and  BasicGraphicsDemo1.java
    1. Paint both filled and unfilled shapes
    2. Paint various shapes:
      1. rectangle
      2. oval
      3. polygon (triangle, pentagon, etc)
      4. line
    3. Paint both thin and thick lines
    4. Paint custom colors
    5. Use trig to position a shape
    6. Use variables to make shapes change properly when the window is resized.
    7. Use variables to draw variants of the same shape by reusing or sharing code.
       

    END OF Hw2 and Quiz 2 MATERIAL

     

  3. Initial Style Guidelines

    Style Counts!
    Starting with hw3, and increasingly on each subsequent homework.
     
    1. Naming
      Use well-named variables.  Single-letter variable names are only acceptable in special situations, like "x" and "y" for coordinates.  In general, variable names should be whole words (like "left") or even multiple words (like "rectangleLeft", which may hold the left side of a rectangle).
       
    2. Capitalization
      Capitalize variables in lowerMixedCase and classes in UpperMixedCase, as shown.
       
    3. No "magic numbers"
      Any number that is not -1, 0, 1, or 2 is a magic number and should be stored in a well-named variable for clarity and generality.
       
    4. Formatting
      Indent and space your programs like the sample code provided (more on this later).
       
    5. Commenting
      Provide clear and concise comments where needed to clarify your code.  Never provide obvious comments (like "add one to x" on a line that reads "x++;").  Your comments should not say what the code does (your code says that!), but why it does it that way or some other clarifying text.
       
    6. UI
      Provide a clear and concise user interface (UI), whether in a console or a GUI (graphical user interface).  Unless otherwise directed, provide prompts for input, clear explanatory text for output, and meaningful error messages.
       
    7. More later....
       
  4. Quiz 1.  Good luck!

Carpe diem!