Consider following class:
public class Foo
{
public Foo() {}
public void Bar(int input)
{
Console.WriteLine("Working on input ...");
switch(input)
{
case 1:
File.WriteAllText("PATH", "The input is 1");
break;
case 2:
var data = int.parse(DateTime.Now.ToString("yyyy")) + input;
File.WriteAllText("PATH", data);
break;
...
}
}
}
This is a simple class, still have more than 1 responsibility, I think there is 2 responsibilities:
- Logging
Console.WriteLine
- Persistence
File.WriteAllText
Maybe there is more than this 2
Is there any guideline in order to helping us detect class responsibilities, so we can refactor it and for example apply SRP?