2 comments

[ 0.23 ms ] story [ 9.1 ms ] thread
Another reason, which I think I wrote as an answer to the very Stack Overflow question mentioned in TFA, is because of data structure invariants and the function contracts.

    Public methods usually have a contract of "take the object in a consistent state, do
    something sensible, leave the object in a (possibly different) consistent state". Here,
    "consistent" may mean, for example, that the `Length` of a `List<T>` is no greater than
    its `Capacity` and that referencing the elements at indices from 0 to `Length-1` won't
    throw.

    But inside the object's methods, the object may be in an inconsistent state, so when
    you call one of your public methods, it may do a very wrong thing, because it wasn't
    written with such a possibility in mind. So if you plan to call your public methods from
    your other methods, make sure that their contract is "take the object in some state, do
    something sensible, leave the object in a (possibly different) (maybe inconsistent — but
    only if the initial state was inconsistent) state".