在我的工作中,我对这个样本工厂的UMLing类图有很多不同意见:
class Program
{
private static TrainComponentsData _trainComponentsData;
static void Main(string[] args)
{
InitTrainComponentsData();
string str = _trainComponentsData.ToString();
}
private static void InitTrainComponentsData()
{
ITrainComponentsReader reader = TrainComponentsReaderFactory.Create("XML");
_trainComponentsData = reader.Read();
}
}
public class TrainComponentsReaderFactory
{
internal static ITrainComponentsReader Create(string readerType)
{
//....
}
}
internal class XMLTrainComponentsReader : ITrainComponentsReader
{
//....
}
public class TrainComponentsData
{
//....
}
internal interface ITrainComponentsReader
{
TrainComponentsData Read();
}
我对各种不同的图表有点困惑:
等...
谢谢!