Product SiteDocumentation Site

11.3.3. Object-Oriented SuperCollider

SuperCollider is difficult to describe precisely, because its syntax allows great flexibility. There are many different ways to accomplish the same task. Each one is subtly different, and gives you a different set of possibilities, but there is often no "best solution." One of the advantages to this is that it easily allows three "programming paradigms," although one is used much more often than the others.

11.3.3.1. Imperative Programming

Imperative programming is easy to understand: it is simply a list of commands, like this:
(
   var a, b, c;

   a = 12;
   b = 25;
   c = a + b;
   a.postln;
)
Declare the variables, set the variables, do a calculation, and print the result of the calculation. This is a simple example, and a simple model, but it is very difficult to escape completely. After all, humans think of large problems in terms of algorithms (the instructions needed to do something). Computers solve large problems, so being able to program them with a series of instructions makes sense.