Procedural Terminology
- Side Effecs: when a chanege escapes the current code running.
int z = 2; // change in memory - stack
h.paint('Blue'); // change in memory - heap
input.nextInt(); // input
printf("%s", 'hi'); // output
Expression v.s. Statement: return values v.s. side effects
- Declarative: mainly use expressions
- Imparative: embed expressions inside statements
Procedural Terminology
- Function v.s. Procedure: return values v.s. side effects
- Functional: only functions
- Procedrual: have both (note: C++/Java - void return values is actually procedure
- Referential Transparency: can be "replaced with", i.e. no side effects
- Referentail Opacity: cannot be "replaced with", i.e. contains side effects
Procedural Terminology
- Argument v.s. Parameter: passers (things you are passing in) v.s. receivers (things that receive what have passed in)
- Operator v.s. Operand: actions (the symbols) v.s. actors (the variables)
- Unary v.s. binary: taking one operand v.s. taking two operands
- Infix v.s. Prefix v.s. Postfix v.s. Mixfix: between v.s. before v.s. after v.s. multiple places
3 + 4 // Infix
+ 3 4 // Prefix
3 4 + // Postfix
(x > 2) ? 3 ; 5 // Mixfix