1 Reading Guide
CPSC 124 Introduction to Programming Spring 2024

Reading Guides


Eck 1.1, 1.3-1.6

Chapter 1 provides important context for the study of programming - it describes how computers run programs, introduces the fundamental building blocks of programs, and discusses some elements of program organization.

Key points to pay attention to:


Eck 2.1-2.2, 2.4.1, 2.4.6

Chapter 2 introduces the most basic building blocks of Java programming — the structure of a Java program and the syntax, semantics, and pragmatics for instructions involving the manipulation of data.

When reading material which introduces specific syntax, it is useful to first read for the ideas and to ignore the details of the syntax — focus on what kinds of things you can do and what various constructs are for (e.g. "assignment statements are for storing values in a variable"). Then go back and pay closer attention to the details of the syntax. (It's also a good idea to devote a few pages at the front of your notebook to a syntax summary — write down an example of each kind of instruction, so you can quickly look it up until you've memorized it.)

Terms, definitions, and concepts to pay attention to:

Constructs to pay attention to (that is, memorize the syntax, semantics, and pragmatics/style):


Eck 2.3.1-2.3.3, 2.5.1-2.5.4, 2.5.6-2.5.7

Sections 2.3 and 2.5 deal with ways to manipulate and compare values.

Terms, definitions, and concepts to pay attention to:

Constructs to pay attention to (that is, memorize the syntax, semantics, and pragmatics):


Eck 2.5.3-2.5.4, 3.1.1, 3.1.3-3.1.4, 3.5

This reading introduces one of the major flow-of-control constructs: conditionals (or if statements), used for making choices.

Terms, definitions, and concepts to pay attention to:

Syntax and semantics to pay attention to: (memorize these)


Eck 3.1.2, 3.3.1, 3.3.3, 3.4.1-3.4.2

These sections focus on one of the other major flow-of-control constructs: repetition. (Computers, after all, are very good at doing the same thing over and over.)

Terms, definitions, and concepts to pay attention to:

Syntax and semantics to pay attention to: (memorize these)


Eck 3.4.3

Terms, definitions, and concepts to pay attention to:

Syntax and semantics to pay attention to:


Eck 3.8.1-3.8.3

These sections introduce arrays, a data structure for conveniently storing and manipulating a collection of related values.

Terms, definitions, and concepts to pay attention to:

Syntax and semantics to pay attention to: (memorize these)


Eck 3.8.5, 7.6.1-7.6.3

These sections extend the idea of an array to higher dimensions — a 2D array represents a grid, rather than a row, of boxes. The last two sections (7.6.2-7.6.3) provide examples of applications.

Terms, definitions, and concepts to pay attention to:

Syntax and semantics to pay attention to: (memorize these)


Eck 4.1, 4.2.1-4.2.3, 4.3.1-4.3.6

Chapter 4 introduces subroutines, a powerful tool for organizing your program and managing the complexity of large tasks. These sections introduce the idea of subroutines, the basic syntax for defining and calling subroutines, and the syntax and semantics of parameters.

Key points to pay attention to:

Syntax and semantics to pay attention to: (memorize these)


Eck 4.6.1-4.6.3, 4.6.5, 4.7.1, 4.3.7

A subroutine's contract is vitally important — it's what bridges the gap between the body of the subroutine and the rest of the program. These sections address some topics related to the contract.

Key points to pay attention to:

Syntax and semantics to pay attention to: (memorize these)


Eck 4.4

Parameters are half the story — they let the caller customize the subroutine. Return values are the other half — they let the subroutine communicate back to the caller.

Key points to pay attention to:

Syntax and semantics to pay attention to: (memorize these)


Eck 3.7.1-3.7.2

This section introduces exceptions. Exceptions provide a way to step out of the normal flow of control of the program to handle errors or other exceptional occurrences.

Don't worry too much about the examples involving enums or the terminology about subclasses and subroutine parameters — just get what you can out of the text and examples. The goal at this point is not a deep mastery of exceptions and exception-handling, but enough of an understanding of what they are to make sense of exceptions that will arise as you write programs and to be able to handle an occasional cases where you'll need or want to be able to catch exceptions.

Key points to pay attention to in this section:

Syntax and semantics to pay attention to: (memorize these)


Eck 4.8.1, 4.8.3-4.8.4

This section mentions a few odds-and-ends which don't really have anything to do with subroutines, but which are useful to know about. (Many of them have already been seen and used without having been formally introduced.)

Notes: Several paragraphs of section 4.8.1 talk about (static) member variables — you can skip these paragraphs. Also, the example in section 4.8.3 uses a class (Mosaic) that we haven't talked about, but understanding Mosaic is not essential for seeing how named constants are being used.

Key points to pay attention to:

Syntax and semantics to pay attention to: (memorize these)

Syntax and semantics to pay attention to — it's not essential that you use these but you should be aware of what they mean when you see them:

"Objects" handout; Eck 1.5

These readings introduce a new topic — objects and classes. Objects and classes are a powerful organizational tool which take the idea of subroutines and go a step farther, bundling multiple subroutines (and some relevant variables) together.

The point of this reading is the concepts of objects and classes; don't worry about specific syntax yet.

Note: The "Objects" handout is not actually for Java — it's for a language called Processing. But Processing and Java are very similar, and it does a nice job of introducing the idea of objects. Don't worry about any syntax that it shows or things like the first paragraph on page 123 where it talks about specific things done in specific places in the program. In the second section (8.2), it talks about an example using a car — think of an animation of a car using the framework discussed in class (and used in lab 6). The "Data" things are variables for the things that change over time (declared where marked at the beginning of the class), the "Setup" things are what you do before the animation starts (done where marked in start), and the "Draw" things would go into drawFrame to display the animation.

Key points to pay attention to:

Eck 5.1.1-5.1.2

These sections introduce the syntax and semantics of objects and classes in Java.

Key points to pay attention to:

Syntax and semantics to pay attention to: (memorize these)

Eck 5.4.1, 5.4.3

These sections present Card, Deck, and Hand classes and give an example program that uses them. Read through the example, paying attention to the creation and usage of objects.


Eck 5.1.3, 5.2

These sections introduce things relevant to the writing of classes in Java.

Key points to pay attention to:

Syntax and semantics to pay attention to: (memorize these)

Eck 5.4.2

The section introduces the Card class (which you are already familiar with), and gives the complete implementation for the class. Read through the code for the class and make sure you understand it.


Eck 5.3.4, 5.4.1-5.4.2

Section 5.3.4 talks a bit about designing an object-oriented program — that is, deciding on what classes you will need and what methods each of those classes will have.

Key points to pay attention to:

Sections 5.4.1-5.4.2 have an example of designing and implementing classes. Pay particular attention to the discussion about the design of these classes. Why were the particular methods chosen? Are Deck and Card reusable classes? What makes them reusable?


Eck 3.8.4, 7.2.1, 7.2.4

Arrays are immensely useful, and we have only just scratched the surface of working with arrays. Sections 3.8.4 and 7.2.1 address using arrays when the number of things in the array changes over time — and may even grow large. These sections only introduce new concepts (i.e. patterns for using arrays) rather than new syntax - and so your reading should focus on these concepts rather than trying to memorize the code examples given.

Key points to pay attention to in these sections:


Eck 7.3.1-7.3.3

The main part of this reading is what ArrayList is for and how to use it.

Section 7.3.2 talks about wrapper classes and autoboxing. This is important if you want to put primitive types (int, double, boolean, char, etc) in an ArrayList.

Finally, sections 7.3.1 and 7.3.3 introduce ArrayList. Don't worry about the examples involving the funny-looking 'for' loops (known as 'for-each loops').

Key points to pay attention to in this section:


Eck 5.5.1-5.5.3, 5.6

Classes and objects are very useful: the program's organization can more closely mimic how one might tend to think about the problem - e.g. you think about manipulating cards and decks and hands, and that's what the program does too. In addition, classes provide easily-reusable modules.

Inheritance makes it easier to reuse classes.

These sections introduce the idea of inheritance and some of the syntax that goes along with it. Section 5.6.1 introduces a special variable called this — the application discussed in the section is worth knowing about though it is not a problem we have (because of our naming convention for instance variables). In class, we'll talk about two other cases where this is quite useful.

Key points to pay attention to:

Syntax to pay attention to: (memorize these)


Eck 5.5.4-5.5.5

Classes and objects are very useful: the program's organization can more closely mimic how one might tend to think about the problem — e.g. you think about manipulating cards and decks and hands, and that's what the program does too. In addition, classes provide easily-reusable modules.

Abstract classes provide more flexibility when using inheritance. Polymorphism makes it possible to write flexible code which can work with many different classes, and even classes that haven't be written yet.

Key points to pay attention to:

Syntax to pay attention to: (memorize these)


Eck 5.7.1, 5.7.3

Classes and objects are very useful: the program's organization can more closely mimic how one might tend to think about the problem — e.g. you think about manipulating cards and decks and hands, and that's what the program does too. In addition, classes provide easily-reusable modules.

Interfaces provide more flexibility when it comes to writing code which can work with many different classes (and even classes that haven't be written yet).

Key points to pay attention to:

Syntax to pay attention to: (memorize these)