jon ninpoja wrote:so when would you use a static method and when would you use an enum? or am i missing something here?
jon ninpoja wrote:do they not both deal with constants?
I presume you are using “instance” in the sense of “under these circumstances” rather than “instance of a class”. As I said earlier, pure functions are usually implemented as static methods.
Les Morgan wrote:. . . unless you know . . . what they do for the instance you want . . .
Many people believe there should be no such thing as a static variable. Only constants.
Jack Ramon wrote:Static variable: When you need something that will be used through out the application and every instance need to know the variable. . . .
That is very vague. But pure functions usually are marked static.
Static function: Used to do some utility task. . . .
In an object language like Java®, everything should default to being instance type. Only make things static as an exception to that rule with a good explanation.
static or instance depends on your uses .