Computer Science: Programming with a Purpose

Description

The basis for education in the last millennium was “reading, writing, and arithmetic;” now it is reading, writing, and computing. Learning to program is an essential part of the education of every student, not just in the sciences and engineering, but in the arts, social sciences, and humanities, as well. Beyond direct applications, it is the first step in understanding the nature of computer science’s undeniable impact on the modern world. This course covers the first half of our book Computer Science: An Interdisciplinary Approach (the second half is covered in our Coursera course Computer Science: Algorithms, Theory, and Machines). Our intent is to teach programming to those who need or want to learn it, in a scientific context.

We begin by introducing basic programming elements such as variables, conditionals, loops, arrays, and I/O. Next, we turn to functions, introducing key concepts such as recursion, modular programming, and code reuse. Then, we present a modern introduction to object-oriented programming.
We use the Java programming language and teach basic skills for computational problem solving that are applicable in many modern computing environments. Proficiency in Java is a goal, but we focus on fundamental concepts in programming, not Java per se.
All the features of this course are available for free. It does not offer a certificate upon completion.

What you will learn

BASIC PROGRAMMING CONCEPTS

Why program? This lecture addresses that basic question. Then it describes the anatomy of your first program and the process of developing a program in Java using either virtual terminals or a program development environment, with some historical context. Most of the lecture is devoted to a thorough coverage of Java’s built-in data types, with example programs for each.

CONDITIONALS AND LOOPS

The if, while, and for statements are Java’s fundamental control structures. This lecture is built around short programs that use these constructs to address important computational tasks. Examples include sorting, computing the square root, factoring, and simulating a random process. The lecture concludes with a detailed example illustrating the process of debugging a program.

ARRAYS

Computing with a large sequence of values of the same type is extremely common. This lecture describes Java’s built-in array data structure that supports such applications, with several examples, including shuffling a deck of cards, the coupon collector test for randomness, and random walks in a grid.

INPUT AND OUTPUT

To interact with our programs, we need mechanisms for taking information from the outside world and for presenting information to the outside world. This lecture describes several such mechanisms: for text, drawings, and animation. Detailed examples covered include fractal drawings that model natural phenomena and an animation of a ball bouncing around in the display window.

What’s included