M/F 2:30-3:20   
in Philips 101

CS 1130: Transition to OO Programming

Spring 2015

Part 4. Variables, Declarations, and Assignments Part 6. The Class Definition

Module 1, Part 5

Objects and Classes

This part 5 introduces you to the notions of object and class, as well as associated concepts that are needed in the beginning. The reading for this part is Gries/Gries, Section 1.3, pp. 30-41.


1. Objects as Manila Folders, Classes as File Drawers

Web Lecture

Reading: Lecture Notes (Lecture Slides)
Gries/Gries, Sections 1.3.1–1.3.2, pp. 30–32

Comments: Learn what a class and an object are, through an analogy. The analogy abstracts away from the computer, hiding unnecessary details and making the concepts easier to understand. Later, you can learn something about how these concepts are implemented in the machine itself. But for now, the emphasis is on ease of understanding.

Self-help Exercises: Drawing Objects

2. Creating and referencing objects.

Web Lecture 

Reading: Lecture Notes (Lecture Slides)
Gries/Gries, Sections 1.3.3 pp. 33–39.

Comments: Learn about the type of object names for a class, how to reference a component (method or field) of an object, and the Java expression for creating an object.

Self-help Exercises: Evaluating new-Expressions

3. Class JFrame

Web Lecture

Reading: Lecture Notes
Gries/Gries, Section 1.3.1, pp. 19–20.

Comments: Watch execution of statements that create objects and save their names in variables and execution of calls on methods in those objects, using an object of class JFrame, which is associated with a window on your monitor.

4. Packages and the Import Statement.

Web Lecture

Reading: Lecture Notes
Gries/Gries, Sec. 11.1, pp 327–331.

Comments: Learn that a package is a bunch of classes that are stored in a particular place. "Importing" them makes it easier to refer to them.