Instructor Manual for Introduction to Computing and Programming ...

See http://coweb.cc.gatech.edu/mediaComp-teach for a list of schools that are
using the Python or Java version of media computation. ... Students do not find
programs that convert temperature or compute sales tax very interesting. ..... Try
some high and low sounds to show that low sounds have less cycles per second.

Part of the document


Instructor Manual
Introduction to Computing and Programming with JAVA
A Multimedia Approach
By Mark Guzdial and Barbara Ericson

May 2006

Purpose

The purpose of this book is to introduce computing in a way that students
find motivating, creative, and relevant. Students enjoy writing programs
to modify pictures, sounds, Web pages, and movies. We still teach all the
usual introductory concepts such as variables, methods, arrays, looping,
conditionals, objects, classes, inheritance, and interfaces, but in a
multimedia context. One of the advantages of this approach is that it is
easy to tell if your program is working or not by looking at (or listening
to) the resulting media.

This media computation approach was first created for an undergraduate
course at Georgia Tech for non-majors using Python. This course has
increased the success rate for non-majors (business majors changed from a
49% success rate to an 88% success rate). Other colleges and universities
have trialed the Python version with similar results. See
http://coweb.cc.gatech.edu/mediaComp-teach for a list of schools that are
using the Python or Java version of media computation. Please let us know
if you are using this approach so that we can add you to the list (e-mail
ericson@cc.gatech.edu or guzidal@cc.gatech.edu). The Georgia Tech
introductory course has resulted in non-major students taking a computer
science minor and even caused some to become computer science majors. And,
with a 40-60% drop in computer science majors at the college level across
the country, it is important that we attract people to computer science,
instead of driving them away. We particularly would like to attract more
women and minorities (especially African Americans and Hispanics) to
computer science. The speed of modern computers means that we can
introduce computer concepts by manipulating media instead of just having
the computer print out "Hello World" and other such assignments which we
have been using for over 30 years. Students do not find programs that
convert temperature or compute sales tax very interesting. They do not
find such examples relevant to their lives.

Chapter 1

This chapter introduces computer science as a study of recipes (programs).
It uses the recipe analogy to introduce many of the sub-fields of computer
science (such as algorithms, data structures, theory, artificial
intelligence, human-computer interface, and so on). Many students do not
know what computer science is and/or think it is just programming, so this
is an attempt to broaden their understanding of computer science. A good
activity might be to research one of these sub-fields or look up how
computers are used in an area the student is interested in. You could show
one of the videos from the University of Washington which interviews
several female computer science majors after they graduate and are working
at Google, Amazon, and Microsoft. See
http://www.cs.washington.edu/education/ugrad/prospective/outreach.html for
these videos. You can also lookup jobs in the U. S. Department of Labor's
outlook handbook at
http://www.umsl.edu/services/govdocs/ooh20022003/ocos267.htm. You can read
bios on female computer science majors at
http://women.cs.cmu.edu/Teachers/bios/. You can also show CMU's roadshow
which is at http://women.cs.cmu.edu/Teachers/roadshow/. If you are
teaching high school students you might want to show them the blogs by
current students and videos diaries of student at Georgia Tech. See
http://www.cc.gatech.edu/content/view/124/55/

We introduce the concept of a programming language and show code for the
"Hello World" example in several languages. We talk about why there are so
many programming languages and introduce Java. We talk about the
differences between a program and an algorithm. A good activity might be
to look up the history of some of the programming languages. When were
they popular? What were they used for?

An important point in section 1.2 is the power of encoding. We introduce
the binary number system. One useful way to do this is to challenge the
students to count to more than 5 with the fingers on one hand, but still
counting up by 1. We introduce Moore's Law so that students will
understand why computers keep getting faster. A good activity might be to
use groups of students to create binary numbers by sitting or standing to
show a 1 or 0.

In section 1.3 we introduce how media is digitized and show that the speed
of modern computers makes it possible to teach computing by writing
programs that manipulate media. Students could read about how digital
cameras and CDs work at http://www.howstuffworks.com.

In section 1.4 we make the case for why students should want to learn about
computing. Most digital media is created and processed on a computer so
students should have some sense for how this is done and what is possible.
Alan Perlis gave a talk in 1961 that made the argument that computer
science and programming should be part of a general education. The United
States is one of the few industrialized countries that does not require
high school students to take computer science! As our society depends more
and more on technology all high school and college students should have
some understanding of computing. A good activity might be a debate on the
merits of teaching some computer science to everyone.

Chapter 2

In this chapter we talk about the history of Java and describe objects and
classes involved in a restaurant. One good activity is to have the
students role-play the people in a restaurant. You can ask for students to
play the greeter, customer, waiter, and chef. Tell them the task is to get
the customer fed and then tell them to go. Point out what they are doing
and what data they need to keep track of. For example, a greeter has a
chart of all the tables in a restaurant, a waiter knows the tables she is
waiting on and the orders for the customers, a chef knows what food is
available and how to prepare it. Point out other objects like order, bill,
and food. Point out that there can be many objects of the same type, like
6 waiters, 3 chefs, and hundreds of customers.

In section 2.2 we introduce DrJava. You don't have to use DrJava to use
this book. However, DrJava is free and has an interactions pane which
allows students to type in Java statements and executes them without having
to create a class and a main. This is the main reason we use DrJava. Many
Java books start out with the students typing all Java code in the main
method and we don't like telling students to just memorize the syntax of
the main method without explaining what it means. Of course, if you don't
wish to use DrJava you can do this, and we even include a class Test.java
for the students to use in the bookClasses directory.

But, even if you use another development environment consider using DrJava
in class to show your students what happens when you type things in the
interactions pane. Students both enjoy seeing things done live and enjoy
when the teacher makes a mistake. Students learn from our mistakes, so
don't be afraid to make some. Make sure that your students copy the
bookClasses directory from the CD to a directory they can modify and add
the path to that directory to the classpath in your development
environment. Instructions for how to do this in DrJava are in section 2.2
but all you need to do is click on "Edit" and then "Preferences" and then
add the full path to the bookClasses directory to the Extra Classpaths as
shown below (Figure 1). Java doesn't create executables that have all the
required code included like some other languages do. Instead Java loads
class definitions as they are needed, so it needs to know where to look for
the classes you are using. By adding the bookClasses directory to your
extra classpath list you are telling it to look there when it is looking
for a class that isn't part of the Java language.

[pic]
Figure 1. Adding bookClasses to the Extra Classpath List

Two things you might want to do as the instructor with DrJava are turn on
line numbers and change the font to a bigger font. You can do each of
these in the Preferences Window. Click on "Edit" and then on
"Preferences". The Preferences window will show. Click on "Display
Options" in the area on the left. Click the checkbox to "Show All Line
Numbers" (see Figure 2). Then click on the icon next to the "Display
Options" to see the subparts which are "Fonts" and "Colors". Click on
"Fonts' and change the fonts used to display the code (Figure 3). We find
the using size 24 for the Main Font displays the code so that students can
read it. Be sure to click "Apply" and then "OK" to save these options.

[pic]
Figure 2. Showing Line Numbers

[pic]
Figure 3. Changing the Font

In section 2.3 we introduce Java math operations. We show how to print the
results of an expression to the console. We emphasize that parentheses
must match: you must have a closing parenthesis for each opening
parenthesis. We show the difference between integer division and floating
point division and introduce casting as one way to stop the truncation to
integer. We introduce Java relational operators. We discuss the Java
primitive types and how much memory each takes. We introduce the type
String and show string concatenation. We also discuss what happens when
you concatenate a number to a string inside of a print statement. Make
sure to do this live in front of the students and ask them to predict the
result of something like System.out.println("The result is " + 2 + 3);.

At some point in here show students that if they make is mistake when
typing in the interactions pane th