static methods

  • Thread starter Thread starter Tem
  • Start date Start date
T

Tem

Are static methods good for performance when no instance specific
reference/property is called? or is it better to just leave them as
non-static methods?

Tem
 
The performance aspect isn't terribly exciting - it isn't going to be
a huge factor either way in most code.
However, if a method doesn't relate to any specific instance, then a
static method may be desirable simply from a semantic perpective;
apart from anything else, this avoids the need to have to create an
instance of an object simply to call a method that doesn't care about
that object. The downside is that there is no static polymorphism or
interface implementation.

Marc
 
Back
Top