Hi guys, Please take a look at this piece of code I came up with.
abstract class Command
{
public void Execute(string[] commandParameters)
{
CommandResult result = ExecuteCommand(commandParameters);
PrintResult(result);
}
public abstract CommandResult ExecuteCommand(string[] commandParameters);
public abstract void PrintResult(CommandResult result);
}
There will be several commands inheriting from this Command class. Each command would override ExecuteCommand and PrintResult. Although with this design, for the client code, I am exposing both Execute and ExecuteCommand function which is wierd. I feel like I need to define a template for a function but not expose other functions which are used in that template! Refactoring fellas, my code sucks almost all the time, please let me know what might be the best way out here.