A Model For Thought
Alan J. Perlis. Structure & Interpretation of Computer Programs
Organising The Particulars
Computers are essentially clocks ticking over a multitude of tasks, shifting and modifying data around at amazing speed. To do this, they execute programs; a pattern of rules that execute pre-determined operations on a set of data. Since the arrival of desktop computers in the early eighties, the interface of the command line and that of programming has been mostly rendered opaque. Nowadays, the majority of us manipulate graphical interfaces on the computer and so rarely get to understand these mechanisms. Programming gives us access to a lower-level interface with the machine. One that gives us the possibility to write our own programs and eventually define both the data and data processes within those programs. And that is a powerful paradigm shift for anyone interested in harnessing the full potential of the machine.
A computer program is a written text that defines a process and there are three key parts that make up those processes. At the highest level, we have thinking, without which our ideas could not take form and a process can not be formulated. In the realm of programming we define our thinking through algorithms - a method for describing a formal set of rules. In order to write these algorithms we need the help of two other vital parts that constitute the bare bones of a program: Data and control structures. Data stores symbolic values - a number, a name, an image, a vector, a colour… - whilst control structures deal with processing that data.
The term structure is important here because essentially a process is about things that are related to other things. We are concerned therefore with the relationships in a program between each component. Being able to understand those relationships is vital if ever you want to really get to grips with writing your own programs and translating thoughts into ideas that become fully working programs that implement those thoughts. Structure is what gives thoughts the possibility to evolve and this on all levels of any process. A computer program gives us the environment and the medium to express our ideas, save them, execute them at any time and indeed share them.
While most students are capable of understanding what a program is and playing with the code. i.e. exploring a program written by someone else, changing some values and observing what happens, they find it hard to actually write something from scratch. Putting their own ideas into application through the medium of writing code is a challenge. What I have observed over the years with my students is their difficulty in understanding the various structures of a program. At first hand, it is the visual structure, getting to grips with the syntax and lexical elements of the language. Secondly, it is the logical structure, getting to grips with the flow of data and the various operations that modify that data.
Indeed, one of the major hurdles for many visual artists who are used to manipulating graphical interfaces on the computer, is in getting them to understand the workings of a purely textual and hence more abstract one. Part of my goal in this course is to unveil the mystery of those abstract structures and reveal some of their possibilities within the area of graphics.
Five Core Concepts
Variables | Functions | Control | Loops | Classes
I divide my course into the teaching of five core concepts that underly most modern programming languages. Each concept is presented and explained in a clear and simple manner. I've tried to give some historical context too but the main focus is on understanding how these concepts can be applied to practical use in developing visual tools. It must be said that this is a concise course and it is not my intention to tackle the finer details of each. To go deeper, I've added notes and references.
As part of my teaching, each concept is followed up with a variety of exercises that encourage the student to explore the concept as well as understand its practical use. I will not go into any detail about these exercises as it is not my main aim here. However, I will occasionaly use some student work to illustrate these pages. For example, the image below is a mosaic of student work that resulted from a first excercise on gestalt theory.
A mosaic of student work on Gestalt theory.
Source Code & Examples Online
All source code for this course can be consulted at the course bitbucket repository*. All examples are written for Processing and for P5js and can therefore be consulted directly in the browser without having to install or compile anything on your machines. I also use the wonderful platform, Observable, developed by Mike Bostock, in order to develop on finer details. The beauty of Observable is that we can both explain and explore code in an intuitive manner. As you will see in later chapters, Observable is a powerful tool that I’m most grateful to use in my teachings.
All Source Code is here.
If you would like to see what we are going to study, then you can access all five concepts of the concepts at the link in the side note. You can also find this link in the menu side bar at Overview. The aim of this is to give quick and easy access to code and sketches that appear throughout the course. You will find helpful links to the respective chapters and Observable pages.
See all 5 concepts