Closed wnagrodzki closed 6 years ago
It should probably also be noted that static
is to be preferred over class
.
@pwetrifork I adjusted the text.
If a method is independent of instance state it should be declared as type method, preferably by using static
keyword (or class
in case when the method is designed to be overridden in a subclass).
Instance method independent from instance state would give false impression that it is in fact dependent on instance state. We aim to avoid confusion.
@pwetrifork @Moskacz I have rephrased whole paragraph. Do you think it is good enough to be called final?
This is to avoid methods giving a false impression that they are dependent on the instance state while in fact they are not
If a method is independent from the instance state it should be declared as a
static
method, orclass
method if it is designed to be overridden by a subclass.