Many cognitive tasks are serial in that they require several steps that have to be carried out in a sequence. Here, I outline a new theory of how these processing steps are implemented in vision by networks of neurons that span several areas of the cerebral cortex. The theory explains how individual neurons can contribute to the elementary processing steps, and also how several processing steps can be arranged in a sequence to form more complex visual routines, just as computer programs can be composed of sequences of instructions. Evidence in support of the theory comes from recent neurophysiological findings in monkeys engaged in complex visual tasks. It is likely that future work will allow these ideas to be generalized to other sensory modalities and cognitive functions.