- fundamental style of language
- can increase maintainability, minimize area where bugs can occur, e.g. through better readability, modularity, etc.
- used as main characterization of language, e.g. JavaScript is a multi-paradigm programming language
- a language can support multiple programming paradigms, e.g. JavaScript is a multi-paradigm programming language
- beware: don’t confuse with code style, e.g. formatting etc. ❗️
Imperative
- instructions how to do an operation, doesn’t explain what it does e.g. order of single steps to compute result like a for loop
- explicit
- low-level
Declarative
- instructions what operation to do, not how to do it
- implicit, hides uneccesary details
- high-level
- can use to eliminate or minimize side effects
- side effect: operation that’s dependent on state outside of the operation, e.g. on changing non-local variable, I/O, random numbers, other side effects, etc.