interface IDependency
{
string Baz { get; set; }
}
class Foo
{
IDependency dependency;
public Foo(IDependency dependency)
{
this.dependency = dependency;
}
public void FubarBaz()
{
dependency.Baz = "fubar";
}
}
I could also implement this as:
class FooStatic
{
public static void FubarBaz(IDependency dependency)
{
dependency.Baz = "fubar";
}
}
When should I choose immutable objects over static methods? Are there any situations where the reverse might be true?
Also, it seems to me that immutable objects should not have void methods. What do you think?