Skip to main content
4 events
when toggle format what by license comment
Jan 17, 2018 at 14:49 comment added Imus I would say that if a field is obligated and shouldn't change after construction of the instance, you should not provide a setter. Immutability is a nice thing to have.
Jan 17, 2018 at 12:19 comment added Sharon Ben Asher I would argue that in this scenario, the case for calling the setter in the ctor overrides the above-mentioned best practice principle. at the very least, it is worth considering which is more likely to occur: the setter doing some logic that would be missed if not called in the ctor, ot the subclass overriding the setter for a property that is in the super.
Jan 17, 2018 at 12:12 comment added gervais.b Note that calling overridable method in a constructor is considered a bad practice. stackoverflow.com/questions/18348797/…
Jan 17, 2018 at 10:15 history answered Sharon Ben Asher CC BY-SA 3.0