Originally posted by Sathya Srinivasan:
Ergo, wouldn't you want to define an abstract class with the variable and an abstract setter method on the class the subclasses would actually implement and not an interface?
Well, if it defines the variable, the setter probably should be concrete, not abstract, shouldn't it?
But sometimes you don't know what the class will want to do with the set value, you only know that clients want to set it. In those cases an interface is the perfect choice.
As an example, I recently introduced the following interface in our system:
public interface ExplicitParentSetable {
public void setExplicitParentComponent(Component explicitParentComponent);
}
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus