Introduction to Programming

using the Processing language

Lecturer: Maarten Lamers of the Media Technology MSc program at Leiden University
Teaching assistant: Joris Slob
Course developed by Bas Haring (2004)
Alterations by Maarten Lamers (2005, 2006, 2007)

Introduction    Lecture I    Lecture II    Lecture III    Lecture IV    Lecture V    Lecture VI    Lecture VII    Fun



Announcement

This course is no longer taught by me, but by my colleague Mark Huiskes. As a result, some of the example code was removed from this website.


Introduction

These sheets are to be used for the Introduction to Programming course - using the Processing language. This course is intended for the Media Technology MSc program of Leiden University, but is open to other students also.

Processing is a language that is (still being) developed by Ben Fry (UCLA) and Casey Reas (MIT / Broad Institute). In fact, Fry and Reas won a Golden Nica for their project at the Ars Electronica 2005 festival. Processing is in fact a kind of "shell" around the Java language that simplifies programming of visual programs, and that yields immediate graphical output. This makes it very suitable for learning how to do programming. You should consult processing.org for more specific aspects of the language, for references, demo applications and downloads. These sheets are really only to be used as an aid for the lectures.

As a reference to learning computer programming you could find a suitable book or tutorial yourself. The language covered by such a book maybe either Processing, C, C++, Java or any other imperative programming language. The Processing website mentions some books about Processing. Of the latest book there is even a sample chapter available that may be useful to you.

In this course the basic concepts of programming are covered. These concepts do not change very much between languages. With the basic understanding of programming offered in this course, you can explore programming in other languages yourself quite easily.


Structure of the lectures

There are seven lectures: each starts with a discussion of the assignment of the previous week. Following this, some new programming concepts are introduced. This is mainly done through examples of small programs and their source code. At the end of each lesson you receive small assignments that you do in the afternoon with the aid of an assistant. Some of these are compulsory, others are optional. Additionally, during this course you will receive three larger assignments that you must do.

The source code presented in the sheets is valid for Processing version 0115. Beware of this when you use an older version of Processing, since some details of the language have changed.


How to use these sheets

Each sheet starts with an overview of the programming concepts that you should be familiar with at the end of the lecture. Similarly, some concepts that are specific to the Processing language are mentioned. You should also be familiar with all the keywords that are listed.

The lectures are structured around several examples of small programs and their source code. Alongside most programs you will find a small, but essential part of the respective source code. The whole code is available on a separate page.

For each assignment, the intended outcome can be viewed on the sheets. However, the example source code of the solution becomes available only after the next lecture.


Assignments

There are three types of assignments:

  1. Voluntary assignments. These you can do to practice the subjects learned. You find them at the bottom of each slide, and they have names such as Assignment II.5. The solution of these assignments are discussed in the following lecture.
  2. Lab assignments. Each lecture day, one of the assignments is the lab assignment. Your solution to the lab assignment must be presented to the lab assistant during lab hours of the same lecture day.
  3. Homework assignments. These are larger assignments that can be done at home. Each homework assignment has its own deadline. The results of homework assigments must be presented during lab hours to the lab assisistant to pass it.


Course topics

  • Lecture I - Variables, data types, operators & assignments
  • Lecture II - Functions & mouse interaction
  • Lecture III - Conditions & loops
  • Lecture IV - Arrays
  • Lecture V - Classes & designing complex programs
  • Lecture VI - Recursion, data structures & sorting
  • Lecture VII - Images & libraries

Examination

This course is graded by means of a written examination. You must also successfully complete all the lab assignments and homework assignment, and demonstrate the outcome to the teaching assistant.