2 ms·
Mutability is one of the most overused constructs but this has nothing to do with OOP. The vast majority of variables and fields simply never mutate. That's why
by imtringued 6y ago
Mutability is one of the most overused constructs but this has nothing to do with OOP. The vast majority of variables and fields simply never mutate. That's why its overused. People use a feature simply because it's the default. Making variables immutable by default and requiring explicit mutability would do a lot of good in many programming languages.
- andrekandre 6y agothe other thing is, alot of "state" is emergent or can be derived... lots of people seem to not think in that way and complicate things with too many variables i see this kind of code alot: person { age: UInt birthday: Date } whereas if you have any sense of when "now" is its much better to just calculate the age based on current date person { age: UInt { birthday.YearsUntilNow() //slightly trivialized ^^ } private(set) birthday: Date }