We break down why, in OOP, it is beneficial to keep behavior next to data: we move “external” functions inside a class as methods, learn to call them with dot syntax, and understand why methods “see” an object’s properties. We also discuss mutable state via
var, the nuance of a
val reference, the role of
this when names conflict, as well as invariants and validation via early
return,
require/
check—so that an object stays correct even with invalid input.