.Net 命名约定与 W3C 规范
我很难解决使用 .Net 实现部分 W3C HTML5 规范时遇到的命名约定冲突。
问题是我喜欢遵守标准 .Net 命名约定,即使用 UpperCamelCasing,但 W3C 规范指示命名约定应使用 lowerCamelCasing。
我是否应该偏离规范以编写 .Net 社区友好且熟悉的代码,或者我应该使用 W3C 推荐的约定以尽可能严格地遵守规范,即使这会使我的代码.notVeryPretty()?
编辑
示例:
W3C 定义了一个带有成员 hasFeature()
的接口 IDOMImplementation
。如果我在没有 W3C 规范指导实现的情况下编写 .Net 代码,这些代码将被命名为 IDomImplementation
和 HasFeature()
,但 W3C 定义了上面指定的命名约定。
编辑
以完全不同的方式问这个问题,在使用 .Net 实现其规范时,偏离 W3C 推荐的大小写约定是否有任何缺点?
I'm having a hard time resolving a naming convention conflict I'm having with implementing part of the W3C HTML5 specification using .Net.
The issue is that I like to conform to standard .Net naming conventions, which use UpperCamelCasing, but the W3C specifications indicate that the naming conventions should use lowerCamelCasing.
Should I deviate from the specification in order to write code that is friendly and familiar to the .Net community, or should I use the W3C-recommended conventions in order to stick to the specification as closely as possible, even though this will make my Code.notVeryPretty()?
EDIT
Example:
The W3C defines an interface IDOMImplementation
with a member hasFeature()
. If I were writing .Net code without a W3C specification guiding the implementation, these would be named IDomImplementation
and HasFeature()
, but the W3C defines naming conventions as specified above.
EDIT
To ask this question a completely different way, is there any downside to deviating from the W3C-recommended casing conventions when implementating their specification using .Net?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对 .NET 代码使用
UpperCamelCasing
,对 HTML/CSS/Javascript/其他 W3C 内容使用lowerCamelCasing
。在什么情况下您会使用 W3C 推荐的命名约定来编写 .NET 代码?
编辑:
现在您已经明确了您的意思,我想说,由于您的代码要在 .NET 中使用,因此您应该坚持使用 .NET 约定,甚至当实现 W3C 定义的接口时。
Use
UpperCamelCasing
for .NET code andlowerCamelCasing
for your HTML/CSS/Javascript/other W3C stuff.In what situation would you code .NET code using W3C recommended naming conventions?
Edit:
Now that you have clarified exactly what you mean, I would say that since your code is to be consumed within .NET, you should stick with .NET conventions, even when implementing an interface defined by W3C.