[Page xxi]

This book is intended to introduce computing, including programming, to students with no prior programming experience. One of the lessons from the research on computing education is that one doesn't just "learn to program." One learns to program something [4, 17]. How motivating that something is can make the difference between learning to program or not [6]. Some people are interested in learning programming just for programming's sakebut that's not most people.

Unfortunately, most introductory programming books are written as if students have a burning desire to learn to program. They emphasize programming concepts and give little thought to making the problems that are being solved interesting and relevant. They introduce new concepts without showing why the students should want to know about them.

In this book students will learn about programming by writing programs to manipulate media. Students will create and modify images, such as correcting for "red-eye" and generating negative images. Students will modify sounds, like splicing words into sentences or reversing sounds to make interesting effects. Students will write programs to generate Web pages from data in databases, in the same way that and do. They will create animations and movies using special effects like the ones seen on television and in movies.

Students in courses taught at Georgia Tech have found these programs interesting and motivating. Students have even reported turning in their programs and then continuing to work on them to see what else they can make.

This book is about teaching people to program in order to communicate. People want to communicate. We are social creatures, and the desire to communicate is one of our primal motivations. Increasingly, the computer is used as a tool for communication even more than as a tool for calculation. Virtually all published text, images, sounds, music, and movies today are prepared using computing technology. This book focuses on how to manipulate images, sounds, text, and movies as professionals might, but with programs written by the students.

We realize that most people will use professional-grade applications to perform these same manipulations. So why learn to program these manipulations yourself? Why not just leave it to the developers of Photoshop and iMovie? The answer depends on your interests and career choices.

  • If you have an interest in becoming a computing professional, then it's worthwhile for you to understand how to build programs used in communication. Much of the software in the future will be used for communications, so this is a great domain to start learning useful skills. Most computing classes today are taught in Java, so this book presents the right context for learning programming and in the right language for you.

  • If you expect to be a user of applications in the future, knowing something of how your tools works can make you a so-called "Power User." Most common applications today are much more powerful than most users realize. Many communications applications are actually themselves programmable with scripting languages that enable users to automate tasks in the application. To use all the facilities of an application, it helps to have an understanding of what the application is doingif you know what a pixel is, you can understand better why it's useful to manipulate. To use the scripting facilities of an application, some knowledge of programming is a requirement.

    [Page xxii]
  • If you are a creative person who wants complete control of your communications, you want to know how to do without your applications if you need to, in order to implement your vision. Knowing how to do manipulate media with your own programs means that you can do what you want, if you ever need to. You may want to say something with your media, but you may not know how to make Photoshop or Final Cut Pro do what you want. Knowing how to program means that you have power of expression that is not limited by your application software.

  • Finally, you may have no interest in programming your applications, or programming at all. Is it worthwhile for you to learn this stuff? Students who took our media computation classes at Georgia Tech told us a year later that the course was relevant in their daily life [15]. We live in a technological society, and much of that technology is used to manipulate what we see and hear in our media. If you know something of how that technology works, you have a way of thinking about how to use it, and how it may be used to change your perceptions. Students who are not computer science majors told us a year after finishing the course that they now had a new confidence around computers because they knew something about how they worked [15].

This book is not just about programming to manipulate media. Media manipulation programs can be hard to write, or behave in unexpected ways. Questions arise like "Why is this same image filter faster in Photoshop?" and "That was hard to debugare there ways of writing programs that are easier to debug?" Answering questions like these is what computer scientists do. The last chapters at the end of the book are about computing, not just programming (Chapters 15 and 16).

The computer is the most amazingly creative device that humans have ever conceived of. It is literally completely made up of mind-stuff. The notion "Don't just dream it, be it" is really possible on a computer. If you can imagine it, you can make it "real" on the computer. Playing with programming can be and should be enormous fun.

[Page xxii (continued)]

To Teachers

The media computation approach used in this book starts with what students use computers for: image manipulation, digital music, Web pages, games, and so on. We then explain programming and computing in terms of these activities. We want students to visit Amazon (for example) and think, "Here's a catalog Web siteand I know that this is implemented with a database and a set of programs that format the database entries as Web pages." Starting from a relevant context makes transfer of knowledge and skills more likely, and it also helps with retention.

[Page xxiii]

The majority of the book spends time giving students experiences with a variety of media in contexts that they find motivating. After that, though, they start to develop questions. "Why is it that Photoshop is faster than my program?" and "Movie code is slowhow slow do programs get?" are typical. At that point, we introduce the abstractions and the valuable insights from computer science that answer their questions. That's what the last part of this book is about.

Researchers in computing education have been exploring why withdrawal or failure rates in college-level introductory computing courses have been so high. The rate of students withdrawing from college-level introductory computing courses or receiving a D or F grade (commonly called the WDF rate) has been reported in the 3050% range, or even higher. One of the common themes from research into why the WDF rate is so high is that computing courses seem "irrelevant" and unnecessarily focusing on "tedious details" such as efficiency [22, 1].

However, students have found media computation to be relevant as evidenced by survey responses and the reduction in our WDF rate from an average of 28% to 11.5% for the pilot offering of this course. Spring 2004 was the first semester taught by instructors other than Mark Guzdial, and the WDF rate dropped to 9.5% for the 395 students who enrolled. Charles Fowler at Gainesville College in Georgia has been having similar results in his courses there.

The approach in this book is different than in many introductory programming books. We teach the same computing concepts but not necessarily in the usual order. For example, while we create and use objects early, we don't have students defining new classes till fairly late. Research in computing education suggests that learning to program is hard and that students often have trouble with the basics (variables, iteration, and conditionals). We focus on the basics for ten chapters: three introductory, four on pictures, and three on sounds. We introduce new concepts only after setting the stage for why we would need them. For example, we don't introduce iteration until after we change pixel colors one-by-one. We don't introduce procedural decomposition until our methods get too long to easily be debugged.

Our approach isn't the more common approach of introducing one computing topic per chapter. We introduce computing concepts as needed to do a desired media manipulation (like using nested loops to mirror a picture). Some chapters introduce several computing concepts, while others repeat computing concepts in a different medium. We repeat concepts in different media to increase the odds that students will find an explanation and relevance that works for them, or better yet, find two or more explanations that work for them. The famous artificial intelligence researcher Marvin Minsky once said that if you understand something in only one way, you don't understand it at all. Repeating a concept in different relevant settings can be a powerful way of developing flexible understandings.

Memory is associativewe remember things based on what else we relate to those things. People can learn concepts and skills on the promise that it will be useful some day, but the concepts and skills will be related only to the promises, not to everyday life. The result has been described as "brittle knowledge" [7]the kind of knowledge that gets you through the exam but promptly gets forgotten because it doesn't relate to anything but being in that class. If we want students to gain transferable knowledge (knowledge that can be applied in new situations), we have to help them to relate the knowledge to more general problems, so that the memories get indexed in ways that associate with those kinds of problems [20]. Thus, we teach with concrete experiences that students can explore and relate to (e.g., iteration for removing red-eye in pictures).

[Page xxiv]

We do know that starting from the abstractions doesn't really work for students. Ann Fleury has shown that novice students just don't buy what we tell them about encapsulation and reuse (e.g., [10]). Students prefer simpler code that they can trace easily, and actually think that code that an expert would hate is better. Some of the early methods are written the way that a beginning student would prefer, with values hardcoded rather than passed in as parameters. It takes time and experience for students to realize that there is value in welldesigned systems. Without experience to give the abstractions value, it's very difficult for beginning students to learn the abstractions.

Another unusual thing about this book is that we start using arrays in Chapter 4, in our first significant programs. Typically, introductory computing courses push arrays off until later, since they're obviously more complicated than variables with simple values. But a relevant context is very powerful [17]. The matrices of pixels in images occur in the students' everyday lifea magnifying glass on a computer monitor or television makes that clear.

Our goal is to teach programming in a way that students find relevant, motivating, and social. To be relevant we have the students write programs to do things that students currently use computers for: namely, image, sound, and text manipulation. For motivation we assign openended creative assignments, such as: Create an image collage with the same image at least four times using three different image manipulations and a mirroring. As for the social aspect, we encourage collaboration on assignments and online, public posting of student work. Students learn from each other and try to outdo each other, in a spirit of creative competition.

Ways to Use this Book

This book is based on content that we teach at Georgia Tech. Individual teachers may skip some sections (e.g., the section on additive synthesis, MIDI, and MP3), but all of the content here has been tested with our students.

However, we can imagine using this material in many other ways:

  • A short introduction to computing could be taught with just Chapters 24. We have taught even single day workshops on media computation using just this material.

  • Students with some programming experience could skip or review Chapters 12 and begin at Chapter 3. Students with objectoriented experience could start at Chapter 4.

  • [Page xxv]
  • Chapter 7 is about drawing using existing Java classes. It also introduces the concepts of inheritance and interfaces. The concepts introduced here are also used in Chapter 14 (movies). If you are skipping movies you could skip this chapter as well.

  • Chapters 8 through 10 replicate much of the computer science basics from Chapters 4 through 6, but in the context of sounds rather than images. We find the replication usefulsome students seem to relate better to the concepts of iteration and conditionals better when working with one medium than the other. Further, it gives us the opportunity to point out that the same algorithm can have similar effects in different media (e.g., scaling a picture up or down and shifting a sound higher or lower in pitch is the same algorithm). But it could certainly be skipped to save time. You might want to at least cover class methods and private methods in Chapter 10.

  • Chapter 11 explains how to create classes. This is an essential chapter.

  • Chapters 12 and 13 manipulate text. They also cover exceptions, reading and writing files, reading from the network, import statements, helper methods, some collection classes, iterators, generics, and working with databases. We recommend covering these chapters.

  • Chapter 14 (on movies) introduces no new programming or computing concepts. While motivating, movie processing could be skipped for time.

  • We do recommend getting to Chapter 15 on speed. This is the first chapter that is more about computing than programming.

  • Chapter 16 is about JavaScript. This gives students exposure to another language that is similar to Java. It also discusses interpreters and compilers. It could be skipped to save time.

[Page xxv (continued)]


The programming language used in this book is Java. Java is a highlevel objectoriented programming language that runs on most computers and many small electronic devices. It is widely used in industry and in universities.

The development environment used in this book is DrJava. It was created at Rice University. It is free and easy to use. DrJava lets the student focus on learning to program in Java and not on how to use the development environment. An advantage of DrJava is that you can try out Java code in the interactions pane without having to write a "main" method.

You don't have to use this development environment. There are many development environments that are available for use with Java. If you use another development environment, just add the directory that has the Java classes developed for this book to the classpath. See the documentation for your development environment for how to do this. Of course, you can also use more than one development environment. You could use DrJava for the interactions pane as well as another environment.

[Page xxvi]

Typographical Notations

Examples of Java code look like this: x = x + 1;. Longer examples look like this:

public class Greeter {   public static void main(String[] args)   {     // show the string "Hello World" on the console     System.out.println("Hello World");   } }

When showing something that the user types in the interactions pane with DrJava's response, it will have a similar font and style, but the user's typing will appear after a DrJava prompt (>):

> 3 + 4 7

User interface components of DrJava will be specified using a smallcaps font, like File menu item and the COMPILE ALL button.

There are several special kinds of sidebars that you'll find in the book.

Program 1. An Example Program

Programs (recipes) appear like this:

public static void main(String[] args) {   // show the string "Hello World" on the console   System.out.println("Hello World"); }

Computer Science Idea: An Example Idea

Key computer science concepts appear like this.

Common Bug: An Example Common Bug

Common things that can cause your program to fail appear like this.

[Page xxvii]

Debugging Tip: An Example Debugging Tip

If there's a good way to keep those bugs from creeping into your programs in the first place, they're highlighted here.

Making it Work Tip: An Example How to Make It Work

Best practices or techniques that really help are highlighted like this.

[Page xxvii (continued)]


Our sincere thanks go out to the following:

  • Adam Wilson built the MediaTools that are so useful for exploring sounds and images and processing video.

  • Matthew, Katherine, and Jennifer Guzdial all contributed pictures for use in this book.

  • Thanks for permission to use their snapshots to Georgia Tech students: Jakita N. Owensby, and Tammy C.

  • Thank you to the anonymous reviewers and to Brent Laminack for finding problems and for making suggestions to improve the book.

  • Thank you to Thomas Bressoud and Matt Kretchmar at Denison University for trying an early version of the book and for their feedback on it.

  • Thank you to the high school teachers in Georgia who took summer workshops using versions of this material and taught it to their classes.

Introduction to Computing & Programming Algebra in Java(c) A Multimedia Approach
Introduction to Computing & Programming Algebra in Java(c) A Multimedia Approach
Year: 2007
Pages: 191 © 2008-2017.
If you may any questions please contact us: