Lecture 1

CS 051G

  1. Teaches object-oriented programming in Grace.

  2. Uses locally written library to make it easy to do interesting graphics early in course.

  3. Involves lots of fun programming projects, but teaches practical material necessary to solve problems in many areas.

  4. Will transition to Java before end of course.

  5. Topics & approach similar to CS51

Algorithms

Writing and Executing Grace Programs

Organizational Details

Classtime organization

A Glimpse of Program Organization

On-line notes for this course

Because the lecture time will be filled with developing examples, I will usually put the code for the sample programs in the lecture notes. You can cut and paste them into Grace to try them out. I will try to get these on-line within 24 hours of the lecture.

Grace intro outline:

  1. General form of object definition

  2. Graphics coordinate systems

  3. Constructing items for graphics classes

  4. Mouse event-handling methods

Class Examples:

  1. Design a program to draw "Hello World" at (90,150), and a 50 by 30 filled rectangle at (100,100). When the mouse is pressed the program will also draw two nested ovals and a straight line.

    Click on MakeBox to show the example.

  2. Design a program that first draws the words "up" and "down" on the screen, with the word "up" in red and "down" in gray. When the mouse is depressed, reverse the colors.

    Click on UpDown to show the example.