3 ms·
3. Most objects embody shared state, and we have reached a point where the consequences of that can be severe. Object mutability is an attractive nuisance. Wh
by hinkley 6y ago
3. Most objects embody shared state, and we have reached a point where the consequences of that can be severe.
Object mutability is an attractive nuisance.
Which is a shame because I like bits of OOP.
- imtringued 6y agoMutability 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 }