Christine Alvarado (UC San Diego), Zachary Dodds (Harvey Mudd), Geoff Kuenning (Harvey Mudd), Ran Libeskind-Hadas (Harvey Mudd)
Welcome! This book (and course) takes a unique approach to “Intro CS.” In a nutshell, our objective is to provide an introduction to computer science as an intellectually rich and vibrant field rather than focusing exclusively on computer programming. While programming is certainly an important and pervasive element of our approach, we emphasize concepts and problem-solving over syntax and programming language features.
This book is a companion to the course “CS for All” developed at Harvey Mudd College. At Mudd, this course is taken by almost every first-year student—irrespective of the student’s ultimate major—as part of our core curriculum. Thus, it serves as a first computing course for future CS majors and a first and last computing course for many other students. The course also enrolls a significant number of students from the other Claremont Colleges, many of whom are not planning to major in the sciences or engineering. At other schools, versions of this course have also been taught to students with varying backgrounds and interests.
The emphasis on problem-solving and big ideas is evident beginning in the introductory chapter, where we describe a very simple programming language for controlling the virtual “Picobot” robot. The syntax takes ten minutes to master but the computational problems posed here are deep and intriguing.
The remainder of the book follows in the same spirit. We use the Python language due to the simplicity of its syntax and the rich set of tools and packages that allow a novice programmer to write useful programs. Our introduction to programming with Python in Chapter 2 uses only a limited subset of the language’s syntax in the spirit of a functional programming language. In this approach, students master recursion early and find that they can write interesting programs with surprisingly little code. Chapter 3 takes another step in functional programming, introducing the concept of higher-order functions.
Chapter 4 addresses the question “How does my computer do all this?” We examine the inner-workings of a computer, from digital logic through the organization of a machine and programming the machine in its native machine and assembly language.
Now that the computer has been demystified and students have a physical representation of what happens “under the hood,” we move on in Chapter 5 to explore more complex ideas in computation and, concomitantly, concepts such as references and mutability, and constructs including loops, arrays, and dictionaries. We explain these concepts and constructs using the physical model of the computer introduced in the previous chapter. In our experience, students find these concepts are much easier to comprehend when there is an underlying physical model.
Chapter 6 explores some of the key ideas in object-oriented programming and design. The objective here is not to train industrial-strength programmers but rather to explain the rationale for the object-oriented paradigm and allow students to exercise some key concepts. Finally, Chapter 7 examines the “hardness” of problems—providing a gentle but mathematically sound treatment of some of the ideas in complexity and computability and ultimately proving that there are many computational problems that are impossible to solve on a computer. Rather than using formal models of computation (e.g., Turing Machines), we use Python as our model.
This book is intended to be used with the substantial resources that we have developed for the course, which are available on the Web at https://www.cs.hmc.edu/twiki/bin/view/ModularCS1. These resources include complete lecture slides, a rich collection of weekly assignments, some accompanying software, documentation, and papers that have been published about the course.
We have kept this book relatively short and have endeavored to make it fun and readable. The content of this book is an accurate reflection of the content of the course rather than an intimidating encyclopedic tome that can’t possibly be covered in a single semester. We have written this book in the belief that a student can read all of it comfortably as the course proceeds. In an effort to keep the book short (and hopefully sweet), we have not included the exercises and programming assignments in the text but rather have posted these on the course Web site.
We wish you happy reading and happy computing!
The authors gratefully acknowledge support from the National Science Foundation under CPATH grant 0939149 for supporting many aspects of the development of the “CS For All” course. This book benefitted significantly from feedback from many Harvey Mudd students over the past several years. Professor Dan Hyde at Bucknell University provided detailed comments that have substantially improved this book. In addition, Professor Richard Zaccone at Bucknell University, Professors David Naumann and Dan Duchamp at the Stevens Institute of Technology, Mr. Eran Segev, and several anonymous reviewers have provided many valuable comments and suggestions. While we’ve tried hard to be accurate and correct, all errors in this text are solely the responsibility of the authors. Finally, the authors thank Professors Brad Miller and David Ranum at Luther College who developed the Runestone Interactive ebook tools, Harvey Mudd students Akhil Bagaria, Alison Kingman, and Sarah Trisorus for “runestoning” our manuscript, and Mr. Tim Buchheim for system administration support.