命名规则:指南动词/名词和英语语法的用法 [英] Naming conventions: Guidelines for verbs/nouns and english grammar usage
问题描述
任何人都可以点我到一个网站,或者给我你如何去为接口,类甚至方法和属性与什么物体或方法呢?
Can anyone point me to a site, or give me some wisdom on how you go about choosing names for interfaces, classes and perhaps even methods and properties relating to what that object or method does?
这是专门为微软开发,因此Java去年秋季的doGet等是不是真的使用,但是一些跨越语言障碍必须(我想象的)一般规则存在。
This is specifically for Microsoft development, so Java-esque "doGet" and so on isn't really used, however some general rules that cross language barriers must (I would've thought) exist.
这是例子可能会帮助:我有4个选择名称为接口:
An example might help: I have 4 choices of names for an interface:
IGroupedItem
IGroupableItem
IDataEntity
IGroupedEntity
它们都含有一个形容词和名词,或只是一个名词。纵观.NET框架,好像一定要有某种规则集如此,一致性?除了对方法明显的动词。
They all contain an adjective and the noun, or just a noun. Looking at the .NET framework it seems like there must be some kind of ruleset for this, for consistency? Aside from the obvious verbs for methods.
编辑:虽然这个例子是一个接口,我没有这个限制只是接口。一般原则是类是名词,动词的方法,属性名词。我想,我的意思是首选的代名词。抛出实体无处不在错误
Though the example is an interface, I'm not limiting this to just interfaces. The general guideline is classes are nouns, methods verbs, properties nouns. I suppose what I mean is choice of the synonym. Is throwing "Entity" everywhere wrong
推荐答案
看的 MSDN文章的命名指导方针。简而言之:
Look at the MSDN articles for naming guidelines. In short:
- 使用的名词类名和属性名(很明显)
- 在接口名,开始我并使用名词和/或形容词来描述行为
- 使用动词的方法名称来形容行动
有关你的榜样 - IGroupableItem
For your example - IGroupableItem.
这篇关于命名规则:指南动词/名词和英语语法的用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!