The question is probably quite simple, but I would like to hear what drawbacks we will have with our code.
So, we had a simple implementation and interface for it:
public interface ISettings
{
bool IsOnline { get; set; }
}
public class Settings : ISettings
{
public bool IsOnline { get; set; }
}
The property shows the application state and used in many conditions. The interface in our case is required for implementing settings for different platforms.
My colleague insists on implementing an additional property:
public interface ISettings
{
bool IsOnline { get; set; }
bool IsOffline { get; set; }
}
public class Settings : ISettings
{
public bool IsOnline { get; set; }
public bool IsOffline
{
get { return !IsOnline; }
set { IsOnline = !value; }
}
}
Is it a good practice to have such additional properties just for convenient code-reading?
IsOnline
that simply check the status property (or use extension methods). \$\endgroup\$