|
|
|
|
|
by galaxyLogic
1581 days ago
|
|
I we don't need public static methods then why would we need private static methods either? So, no static methods at all? The reason to define a public static method is it serves as a simple entry-point to the functionality of your class. And what is a constructor if not syntactic sugar for a "static method", which creates and returns an instance? I also don't see the point about 'static coupling". The class whose static method you are calling could come as an argument, so it would not be static coupling after all? |
|
The only reason the recommendation isn't as strong for private static is that the scope of the "virulent" recursive refactor is limited to the class within which this method was located. If there wasn't a public static method calling this private static one, the refactor ends there.
Personally, I recommend against both public static and private static (I think they produce needless work) however only public static meets the bar for a style guide.