- Two usages of assignment:
- Permanent local state: e.g. bank account.
- Temporary local state: scoped by a function execution; e.g. generate unifiorm random numbers (generate Next based on outcome of previous experiment)
- Programming without any use of assignments (more generally, side effects) is known as functional programming. In contrast, programming that makes extensive use of assignment is known as imperative programming.
- OOP: Is an attempt to model real-world phenomena:
- Real-world objects are modelled by computational objects with local state.
- Time variation in the real world are modelled by state assignment.
- Stream processing lets us model systems that have state without ever using assignment or mutable data.
- For any "syntactically equals" expressions E1 & E2, the language is said to be referentially transparent if E1 and E2 can be substituted and the evaluation remains unchanged.
- Encapsulation reflects the general system-design principle known as the hiding principle: providing information access only to those parts of the system that have a "need to know". In contrast, abstraction layering is a general concern to build a system from primitives (low layer) to compound behaviour (top layer) and, thus, controlling complexity.
No comments:
Post a Comment