Object Oriented Programming
The primitive entities are objects which have certain properties
- Objects have Identity
- Objects have State
- Objects have Behavior
Values are not Objects
The primitive entities are values which have none of the properties of Objects
- Values have no identity
- Values have no State
- Values have no Behavior
A positive definition of VOP
- Values are Equivalent
- Values are Immutable
- Values are Side-effect Free
Values are Equivalent
One entity with a value will give the same results as a different entity with the same value. All ‘fives’ are the same. This allows equational reasoning. If `a` and `b` have the same value, `f(a)` and `f(b)` have the same value.
Values are Immutable
‘five’ never becomes ‘six’. Values do not change.
Values are Side-effect free
No operation on a value has an effect on other values. Temporal changes are explicit.
Value Oriented Programming does not deny Objects
- There are things with identity
- There are things that vary over time
- There are things that affect the state of other things
Values are are a better basis
We can, and do, build objects out of values, but objects in the OO sense are impossible to reason about.