This course ended on
December 13, 2016

CPSC 225: Intermediate Programming

   Department of Mathematics and Computer Science
   Hobart and William Smith Colleges

   Fall 2016.

   Instructor:  David J. Eck  (

   Course Handout:

   Monday, Wednesday, Friday, 11:15--12:10 PM
       Coxe 7.

   Lab: Tuesday, 1:30--2:55 PM
       Rosenberg 009.

Lab Worksheets
Lab 1, September 1
Eclipse / Spellcheck
Lab 2, September 8
Sort and Search Times
Lab 3, September 15
Recursion Exercises
Lab 4, September 22
Linked Lists
Lab 5, September 29
Binary Tree Demo
Lab 6, October 6
Kinetic Art
Lab 7, October 13
eCard Designer
Lab 8, October 20
Books and Sets
Lab 9, October 27
eCard Files
Lab 10, November 3
Lab 11, November 10
Web Server
Lab 12, November 17
Web Collage
Lab 13, December 1: Work on Final Projects
Lab 14, December 8: Final Project Presentations

Some Useful Links

First Week: August 29 and 31; September 2

Welcome to the course!

Read Chapter 8, Sections 1 through 3 in the textbook. Looking ahead, we will cover Subsection 8.4.1 but will not cover 8.4.2. (However, I encourage you to read all of Chapters 8 through 13 in the book, even the parts that are not an official part of the course.) On Monday, I will talk in general terms about Sections 1 and 2. We will cover Section 8.3 in some depth on Wednesday. That section is about exceptions and the try..catch statement. You have probably encountered exceptions already; this section adds detail. Please read Section 8.3 before class on Wednesday!

On Friday, after the Thursday lab, we might have to review some things from Introductory Programming. If not, or in any remaining time, we will talk about 8.4.1.

The required reading for the first week also includes the course handout and the style guide that will be handed out on the first class meeting. And you should read Lab 1 before coming to lab on Thursday.

Second Week: September 5, 7, and 9

It turns out that we didn't have time to talk about Section 8.4.1 (assertions), so we will leave that as a reading assignment only (and no, it won't be on the test).

On Monday, we will discuss Section 8.5, which is an introduction to the analysis of algorithms. The question here is how to talk about the run time efficiency of an algorithm, and how to compare the run times of different algorithms for performing the same task. This is a question that we ask about many of the the algorithms that we study later in the course. We will take a somewhat informal approach. If you take our algorithms class (CPSC 327), you will study the analysis of algorithms in a more detailed and mathematical way.

We will move on to Chapter 9 on Wednesday. You should read Section 9.1 before Wednesday's class. Section 9.1 discusses recursion. A recursive method is one that calls itself, either directly or indirectly. Recursion turns out to be a powerful tool for expressing algorithms. We will spend Wednesday and Friday on recursion.

Third Week: September 12, 14, and 16

The reading for the week is Section 9.2. This section introduces the idea of linked data structures. It concentrates on linked lists. A linked data structure is made up of "nodes." A node is an object. In a linked data structure, a node typically contains one or more pointers to other nodes of the same type. In a simple linked list, each node contains a pointer to the next node in the list. We will see that it is often possible to use recursion to process linked data structures, although recursion is usually used with more complicated data structures than linked lists.

Fourth Week: September 19, 21, and 23

The reading for the week is Section 9.3. This section introduces the important idea of Abstract Data Type (ADT). It uses stacks and queues as examples of ADTs. We will look at two implementations of the stack ADT, one using linked lists and one using arrays. We will implement the queue ADT using linked lists. We will also look at some applications of stacks and queues.

Fifth Week: September 26, 28, and 30

The reading for the week is Section 9.4. This section covers binary trees, binary sort trees, and expression trees. We will look at the structure of trees, how they can be created and how they can be processed recursively. In particular, we will see the difference between pre-order, in-order, and post-order traversals of a binary tree. We will also have to return to a topic from Section 9.3: postfix expressions and how they can be evaluated using a stack. It is possible that we might get a start on Section 9.5 by the end of the week.

Note that there is a test coming up next week, on Wednesday, October 5.

Sixth Week: October 3, 5, and 7

There is a test on Wednesday, October 5. A study guide is available, and copies were handed out in class on September 30.

Monday of this week should be mostly review for the test. We will go over some of the sample problems from the study guide. On Friday, we will talk about Section 9.5, which covers the recursive processing of ordinary infix expressions.

Seventh Week: October 12 and 14

There is no class on Monday because of Fall break.

On Wednesday and Friday, we will be starting Chapter 10. The reading from the week is Sections 10.1 and 10.2, although we might not quite finish them this week. Chapter 10 covers generic programming and the Java Collection Framework (JCF). You have already worked with the ArrayList class. The JCF introduces a number of other useful parameterized classes.

The lab on Thrusday is a kind of GUI tutorial that really needs to be read carefully in advance of the lab.

Eighth Week: October 17, 19, and 21

We are continuing with Chapter 10. We will definitely cover 10.3 and 10.4 before the end of the week, and we might start 10.5. (In Section 10.5, we will cover only 10.5.1 and perhaps 10.5.2.)

The week begins with some more set operations, and the lab for the week is about using set operations on large sets of words. From that we will move on to maps, including a look at hash tables and how they are used to implement HashMap.

Ninth Week: October 24, 26, and 28

We start Chapter 11 this week. This chapter deals with input/output using files, networking, and other sources and destinations for data. Java defines the stream abstraction to represent a source of input or a destination for output. There are streams for text and streams for binary data, so there are four abstract stream classes: InputStream and OutputSream for binary data and Reader and Writer for text data. Various subclasses of these abstract classes represent streams with different sources, destinations, and/or capabilities. This includes file I/O, network I/O, and more.

The reading for the week is Sections 11.1 through 11.3, which cover streams and files.

Tenth Week: October 31; November 2 and 4

We continue with Chapter 11. The new reading for the week is Section 11.4, which introduces networking. After finishing our discussion of files and streams, we will start looking at how computers communicate over the Internet. We will cover the basic ideas of the IP and TCP protocolos and the client/server model. We will then look at how network communication is implemented in Java using the Socket and ServerSocket classes.

There is test next Wednesday, November 9, which will cover Sections 10.1 to 10.4 and 11.1 to 11.4.

Eleventh Week: November 7, 9, and 11

There is a test on Wednesday, November 9. A study guide is available.

We will spend Monday reviewing for the test and perhaps finishing up some details of networking. On Friday, we will probably start Chapter 12, but we won't get far into it until next week.

Everyone needs to meet this week to discuss their ideas for final projects. I will have a appointment sign-up sheet to pass around in class on Monday.

Twelfth Week: November 14, 16, and 18

We will be working on Chapter 12, Threads, this week. The reading is Sections 12.1 through 12.3. The lab for this week will use threads and networking to implement a kind of web crawler program. We will have to so some material out of order to prepare for the lab.

Your written final project proposal is due in class this Friday, November 18.

Thirteenth Week: November 21.

There is no class on Wednesday or Friday this week because of Thanksgiving break. On Monday, we will continue with Chapter 12.

Also, my usual Tuesday office hours are canceled this week.

Fourteenth Week: November 28 and 30; December 2

On Monday, we will finish up Chapter 12 with a discussion of wait() and notify(). Note that I will not comver Section 12.5 in class, although I encourage you, as always, to read it anyway.

For the rest of the semester, we will be concentrating on GUI programming. I will spend a little time reviewing some of the material from Chapter 6, and then move on to Chapter 13. The reading for the week is Sections 13.1 and 13.2. We have already encountered some of the material in Sections 13.1 and 13.2 in various labs, but without much explanation, but we will cover that material more officially, along with some really new topics.

Fifteenth Week: December 5, 7, and 9

The final reading for the semester is Chapter 13, Sections 3 and 4. We will concentrate this week on the Model/View/Controller pattern. We will finish that in the first part of the day on Wednesday. After that, we will be reviewing for the final exam.

Final projects are due at the end of this week. You should be prepared to give a presentation about your project in the final lab, on Thursday, December 8. In the presentation, you should demonstrate the program, discuss the structure of the program, and present some of the code that you wrote. Concentrate on the aspects of the code that you think will be interesting to other people in the course. The project is due on Friday, December 9, and it should be in your homework folder by noon on Saturday, December 10. If it is not absolutely clear where I should look for your project, send me an email to let me know. It is possible to get an extension on the due date for the final project until the day of the final exam, but only if you come to my office, discuss the code with me, and present your plan for finishing the project.

Final Exam: December 13

The final exam for this course is at 7:00 PM on Tuesday, December 13. The study guide for the exam is available. You can also review the study guides for the first test and for the second test.

End of semester office hours, Monday, December 12, through Wednesday, December 14, will be 11:00 AM to 3:00 PM.