How to format code

How to format code
1.

In the processing IDE hit ctrl-t to autoformat (indents)

2.

you can insert line breaks to make code better readable:

typical constructor

Button (float x_, float y_, float r_, String filename) {

nicer

Button (float x_, float y_,

float r_, String filename) {

It's nicer because x and y are on the same line (they belong together), then the other parameters follow.

Also when defining texts e.g. in a big array you can begin a new line, but only outside "the texts".

3.

Using small and capital letters.

it's a convention to use small letters for vars and arrays, so better sounds, instead of Sounds.

Capital letters only for class names (so write Button)

and for constants capitals throughout

Thus when you read your code you'll know, this is a constant, this is a class, this is a variable or array. Very convenient.

Also when something is a single thing (e.g. a Button) name it in Singular and not in Plural; when you have an array of bullets, it’s plural (many bullets).

4.

divide your code into functions with good names

5.

use good variable names

6.

be proud not only oft he program you’ve written but also of its code.

'''In general write your code so that a new reader can read it easily and holds lttle surprises for him. '''