Ivan Jozsef Balazs wrote:then I need some guidance what to pass as the status parameter, and interface-defined constants can be useful here.
Moreover the best place to define these constants can be along with the method, that is, in the same interface.
In general, I agree, especially for numeric constants like
π; but purists might say that you're defining a global constant, which might run you into problems later on - for example, when
testing.
After all, in an interface, what's the difference between:
public double pi;
and
public double pi();
?
Some might argue that the latter is actually more flexible...on the other hand, the counter-argument is that it's also more error-prone.
I'm not advocating "constant" methods you understand; just trying to show that there is an alternative.
Winston