Reviewing someone's code, in a non-static class, I noticed there were only private static methods. So those are used internally in its class.
interface IDogInterface
{
void Bark(bool isBarking);
}
public class GoldenRevier : IDogInterface
{
public void Bark(bool isBarking)
{
//Implementation...
SomeMethod();
SomeOtherMethod();
AnotherMethod();
}
private static void SomeMethod();
private static void SomeOtherMethod();
private static void AnotherMethod();
}
Note: there are no static attributes, no getters or setters, only what you saw in the above code.
Why would you make those internal methods static ? I see no benefit doing this.
I see bad logic in the above code... Am I missing something ?
EDIT:
Code edit to highlight the accepted answer meaning.
public class GoldenRevier : IDogInterface
{
private Bark _bark = new Bark();
public void Bark(bool isBarking)
{
if(isBarking)
{
_bark.SetLoudness(5);
_bark.Start();
}
else
{
JustChilling();
}
}
private static void JustChilling()
{
Console.Write("No barking today, just chilling!");
}
}