Re:Observing the second law of thermodynamics in software
by zackmorris on Tuesday May 29, 2018 @08:04PM
(#17183801)
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.
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.