According to Martin Fowler "Something can be public but that does not mean you have published it." Does this mean something like this:
public interface IRollsRoyceEngine
{
void Start();
void Stop();
String GenerateEngineReport();
}
public class RollsRoyceEngine : IRollsRoyceEngine
{
public bool EngineHasStarted { get; internal set; }
public bool EngineIsServiceable { get; internal set; }
#region Implementation of IRollsRoyceEngine
public void Start()
{
if (EngineCanBeStarted())
EngineHasStarted = true;
else
throw new InvalidOperationException("Engine can not be started at this time!");
}
public void Stop()
{
if (EngineCanBeStopped())
EngineHasStarted = false;
else
throw new InvalidOperationException("Engine can not be started at this time!");
}
public string GenerateEngineReport()
{
CheckEngineStatus();
return EngineIsServiceable ? "Engine is fine for now" : "Hmm...there may be some problem with the engine";
}
#endregion
#region Non published methods
public bool EngineCanBeStarted()
{
return EngineIsServiceable ? true : false;
}
public bool EngineCanBeStopped()
{
return EngineIsServiceable ? true : false;
}
public void CheckEngineStatus()
{
EngineIsServiceable = true;
//_EngineStatus = false;
}
#endregion
}
Can it be said that published interface of this is IRollsRoyceEngine not whatever is in RollsRoyceEngine?
If so what is the real difference between public and published methods?