命名约定管制 [英] Naming convention for controls

查看:152
本文介绍了命名约定管制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

微软已经在其网站上的命名原则(这里)。另外我有框架设计指南书。

Microsoft has naming guidelines on their website (here). Also I have the Framework Design Guidelines book.

我找不到什么关于命名控制方针。

What I could not find was a guideline about naming controls.

例如一个按钮,当降到一种形式,它得到的类型名称+数字,骆驼套管作为默认名称,如按钮1。

For example a button, when dropped to a form, it gets the typename + number, camel-cased as default name, such as "button1".

这是我做的:我删号后加一个有意义的描述。例如buttonDelete或buttonSave。

This is what I do: I delete the number and add a meaningful description after. For example "buttonDelete" or "buttonSave".

这样,您就不必维护的控制及其缩写名称的大名单中指引的地方。

This way you do not have to maintain a big list of controls and their abbreviated names in a guideline somewhere.

你同意吗?

推荐答案

我没有习惯这样,但我会尽力十分广阔的名称的类型部分。例如按钮,链接按钮,图像按钮往往会被命名为somethingButton。组合框,单选按钮,列出所有最终成为somethingSelector。文本框和日历somethingInput。这样,我得到的是什么样的控制没有名称的粗略的想法被捆绑到了实际执行。如果我决定用一个下拉替换选项按钮组则没有必要重新命名!

I don't have a convention as such, but I do try to be very broad with the 'type' portion of the name. e.g. Button, Link Button, Image Button tend to be named 'somethingButton'. Combo boxes, radio button lists all end up as 'somethingSelector'. TextBoxes and Calendars are 'somethingInput'. That way I get a rough idea of what sort of control it is without the name being tied to the actual implementation. If I decide to replace an option button group with a dropdown then no need to rename!

这篇关于命名约定管制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆