2
例如,我有两个方法CreateNewDocument和OpenDocument,它们在我的GUI代码中有两个不同的级别。一个是低级别的,只是做了方法名称的含义;另一个是高级别,它会在做所需的工作之前检查现有文档可能存在的不存在。低级别名称出现在高级别代码中,因为它们被调用来实现高级别方法。我的问题是如何区分它们以避免混淆用户和读者?请仔细阅读说明的代码。如何命名不同级别的类似方法?
class GuiClass
{
public:
// Re-implement to tell me how to do the low-level create new document.
virtual void LowLevelCreateNewDocument();
// Then I do the high-level version for you.
void HighLevelCreateNewDocument()
{
// Handle unsavings and blabla...
...
// Then do the low-level version
LowLevelCreateNewDocument();
// Afterward operations
...
}
};
'CreateNewDocument'和'OpenDocument'对我来说似乎是两件非常不同的事情。这两个我都认为是高水平的。 – 2013-03-16 11:53:45