13 ms·
Setters are an anti-feature. They give the illusion that they can be set in any order, but most meaningful classes have invariants that are ambiguous to preser
by brandonbloom 13y ago
Setters are an anti-feature.
They give the illusion that they can be set in any order, but most meaningful classes have invariants that are ambiguous to preserve with single-value setters. Object Oriented designs jump through some serious hoops to preserve the pretty `object.property = value` syntax. Besides, there are considerable advantages to immutability even in the absence of concurrency. `new_object = frob(object, value)` is generally preferable in the long run.