Product SiteDocumentation Site Choosing a Paradigm

At this point you may begin worrying about which programming paradigm you should choose, and when. The answer is unhelpful: "Whichever seems best for the task."
Let's expand on this. If you are primarily a programmer, then you probably already know how to choose the best paradigm and algorithm for the task. If you are a musician, then you probably just want your program to produce the output that you want (in this case, a particular set of sounds). Part of the beauty of SuperCollider's flexibility is that it allows you to produce the same output in different ways. As a musician this means that, as long as your program works as you want it to work, it doesn't matter how you write it. Experience will teach you more and less effective ways of doing things, but there is no need for rules.
Even so, here are some guidelines that will help you to start thinking about music programs:
  • Programs of all sorts often follow a simple, four-step flow. Not all parts are always present.
    1. Declare variables.
    2. Get input from the user.
    3. Calculate something with the input.
    4. Provide output to the user (i.e. "make noise").
  • Repetition is the enemy of correctness, so if you're going to execute some code more than once, try writing a Function. If it's slightly different every time, try using arguments. Arguments with default values are a great way to expand a Function's usefulness.
  • If it looks too complicated, then it probably is. The more difficult it is to understand something, the greater the chance of making a mistake.
  • Don't forget the semicolons at the end of every statement.