I tend to use static methods in abstract classes that are designed using Singleton or Factory patterns, or where there are functions I want accessible within a namespace that has an abstract superparent class. Another reason I use them is sometimes I have instantiable classes, but don't need an entire object, just a particular method (particularly validation methods). An example would be my Project Model, which has dozens of methods covering a range of functionality, but sometimes all I need is a call to \MyNamespace\ProjectModel::IsProjectApproved().
I'm wondering what other people use static methods for, what bad usage is, what good usage is, whether to avoid them, and why?
This post has been edited by e_i_pi: 21 May 2012 - 05:28 PM

New Topic/Question
Reply


MultiQuote





|