3 ms·
I agree, also little or no thought has been given to readonly fields in OOP. I view objects as a natural outcome of mutability, so in that sense they are a cod
by zackmorris 8y ago
I agree, also little or no thought has been given to readonly fields in OOP.
I view objects as a natural outcome of mutability, so in that sense they are a code smell. I've found that using const liberally (and keeping methods free of side effects) significantly reduces the number of variables in each object. Which means that I can make more of those const variables public, which tends towards better reusability/composability.