I'm writing an app it needs to have generic registration step item. It needs to be able to do some specific things (I use interface for that) and it needs to be a visual element (of Xamarin. It doesn't really matter, though), say VisualElement (I use abstract class for that). This is how it all looks like:
public interface IRegistrationStep
{
Task<bool> Validate();
void Minimize();
void Maximize();
}
public abstract class RegistrationStep : ContentView, IRegistrationStep
{
public abstract Task<bool> Validate();
public abstract void Minimize();
public abstract void Maximize();
}
After that, I derive all my steps from RegistrationStep
. If I need the step to be able to do one more thing, I simply add it to the interface, add abstract method to abstract class and implement it in the abstract class implementation... Or maybe not? Like, maybe sometimes I should add methods only to the abstract class and not to the interface?
My question is, how do I decide where to add new methods? Are there examples when its more reasonable to add methods to abstract class and not to the interface?
IContentView
. :) My comment was pointless therefore.RegistrationStep
class? Since none of its methods are implemented, it provides nothing thatIRegistrationStep
doesn't, aside from inheriting fromContentView
.IRegistrationStep
interface if it is only ever (directly) implemented byRegistrationStep
?