class 为 class 装满容器的名称建议

class name suggestions for a class full of containers

我有一个class如下

class Package
{
    list<string> targetList;
    list<string> excludedList;
    map<string, string> mapping;
};

我将在其他几个 class 中使用 Packagecontained 类型的数据结构,这可能需要根据此 input Package P

计算更多信息

例如,具有 Package 实例 P 的处理程序可能需要执行 targetList = targetList - {targetList ^ excludedList} 减去交集后它可能映射每个 targetList 字符串到新字符串 w.r.t 映射

使用 Package、Input、InputCollection、Collection 等名称,阅读我的代码的其他人将无法理解它可能包含的内容。我正在寻找不错的名称建议,因为获得正确的变量名称似乎是自我记录的。

我会说这在很大程度上取决于您的问题领域,没有上下文就无法回答。

您应该问问自己,它是提供算法的通用库还是解决您所在领域的特定问题?

尽可能针对您的域或算法。

也许这对您有帮助:http://www.itiseezee.com/?p=83

只是拿出一条经验法则:

Readers should not need to mentally translate your names into other names they already know/are familiar with. This problem generally arises from a choice to use NEITHER problem-domain terms nor solution-domain terms (see more, below, on problem-domain and solution-domain).