在两种格式之间转换的程序的名称?
这个问题有点傻,但有时很难弄清楚如何正确命名事物。 该转换会将配置文件解析为 XML,反之亦然。 我想调用该程序MyCompany.Config2Xml,但该程序还需要能够“Xml2Config”。
This question is a little silly, but sometimes it's tough to figure out how to name things correctly. The conversion will parse a config file into XML and vice versa. I want to call the program MyCompany.Config2Xml, but the program also needs to be able to "Xml2Config".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
我建议:ConfigParser
I propose: ConfigParser
为了与 SqlDataReader、TextReader、XmlReader 等保持一致,我将其称为 ConfigReader 和 ConfigWriter。
或者,您可以直接采用序列化方法,而不必担心命名约定。
In keeping with SqlDataReader, TextReader, XmlReader etc I'd just call it ConfigReader and ConfigWriter.
Or, you could just go the serialization approach and then not have to worry about naming conventions.
CC简称:
配置转换器?
CC for short:
ConfigConverter ?
与其像 jeffamaphone 提议的那样使用 ConfigParser(+1 表示好的用户名),不如将其设为动词:
这使得它在脚本中可读性更好:
Rather than ConfigParser as proposed by jeffamaphone (+1 for nice username), make it a verb:
This makes it read nicely in scripts:
我认为思考您打算在类中使用的动词(方法)以及类在应用程序中扮演的角色很有帮助。
换句话说,如果您设想操作为 {class}.Get() 或 {class}.Load(),则 ConfigParser可能是一个不错的选择。
另一方面,如果您有相应的 {Class}.Set() 或 {class}.Save() 操作,则类似于 ConfigManager< /em> 将是更好的选择,特别是如果该类将用于将应用程序与其配置的持久性隔离。
如果类的角色只不过是独立应用程序的一部分或较长运行过程中的一个步骤,那么我会更倾向于更像 Convert.ToXml() 的类和方法对Convert.ToConfig() 或 Translate.FromXml() Translate.FromConfig()。
I think it helps a lot to think about the verbs (methods) you intend to use with the class and the role the class plays in the application.
In other words if you envision the operation to be {class}.Get() or {class}.Load() then ConfigParser might be a good choice.
If on the other hand you have a corresponding {Class}.Set() or {class}.Save() operation then something like ConfigManager would be a better choice, particularly if the class will be used to isolate the application from the persistence of its configuration.
If the role of the class is nothing more than part of a standalone application or a step in a longer running process then I would would lean more towards class and method pairs that are more like Convert.ToXml() Convert.ToConfig() or Translate.FromXml() Translate.FromConfig().
一般术语似乎是格式转换器或转换器(与转码器类比)。 就您讨论的具体名称而言,我想我会选择 ConfigConvertor。
General term seems like it would be format convertor, or transformatter (by analogy with transcoder). In terms of the specific names you discuss, I think I'd go with ConfigConvertor.
ConfXmlSwitcher :P
ConfXmlSwitcher :P
DaTransmogrifier
UberConvertPlus
Xml2Config2Xml
ConfiguratorX
DaTransmogrifier
UberConvertPlus
Xml2Config2Xml
ConfiguratorX
“XConTrans”
或简称“Via”
'XConTrans'
or simply 'Via'