为什么不是匈牙利表示法? [英] Why NOT hungarian notation?

查看:69
本文介绍了为什么不是匈牙利表示法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现MS建议我们不要使用匈牙利语符号和.net框架:

http://msdn2.microsoft.com/en-us/library/ms229045.aspx


使用它的真正缺点是什么?


我倾向于使用它,特别是在识别我的控件时。例如,我创建的联系表单中的

控件可以如下ID:


tbx_firstName

tbx_emailAddress

ddl_state


我发现这在代码隐藏时非常有用。


是''没有匈牙利人''仅仅是偏好MS对于我来说,有没有或有特定的缺点?b $ b我是顽固的还是坚持下去?


-Darrel


-

======================================== ========== ===============

赢取奖品搜索谷歌:
http://www.blingo.com/friends?ref=hM...nTqhv-2GE1FNtA

I just discovered that MS recommends that we NOT use hungarian notation with
the .net framework:

http://msdn2.microsoft.com/en-us/library/ms229045.aspx

What are the real cons for using it?

I tend to use it a lot, especially when IDing my controls. For instance the
controls in a contact form I create could be IDed as such:

tbx_firstName
tbx_emailAddress
ddl_state

I find this really helpful when in codebehind.

is the ''no hungarian'' merely a preference MS has, or are there specific cons
to me being stubborn and sticking with it?

-Darrel

--
================================================== ===============
Win prizes searching google:
http://www.blingo.com/friends?ref=hM...nTqhv-2GE1FNtA

推荐答案

" darrel" < no ***** @ nowhere.comwrote in message

news:eV ************** @ TK2MSFTNGP06.phx.gbl ...
"darrel" <no*****@nowhere.comwrote in message
news:eV**************@TK2MSFTNGP06.phx.gbl...

>我刚刚发现MS建议我们不要使用.net框架使用匈牙利语表示法:

http://msdn2.microsoft.com/en-us/library/ms229045。 aspx



很奇怪,不是吗!多年来一直风靡一时,突然之间他们不再像以前那样花了b $ b ...

Weird, isn''t it! It was all the rage for years, then suddenly they don''t
like it any more...


什么是真实的使用它的利弊?
What are the real cons for using it?



无论如何。

None whatever.


我倾向于使用它,特别是在识别我的控件时。
I tend to use it a lot, especially when IDing my controls.



我也是 - 所有时间。

Me too - all the time.


我发现这在代码隐藏时非常有用。
I find this really helpful when in codebehind.



同样。

Likewise.


是''没有匈牙利人''仅仅是MS的偏好,
is the ''no hungarian'' merely a preference MS has,



我不知道......

I have no idea...


或者是否有特定的缺点让我固执并坚持下去?
or are there specific cons to me being stubborn and sticking with it?



无论如何。

None whatever.


>还是有特定的缺点让我固执并坚持下去?
>or are there specific cons to me being stubborn and sticking with it?

>

无论如何。
>
None whatever.



哈!谢谢你的反馈,马克。至少我可以找到和平与我知道

,我并不孤单,想要坚持下去。 ; o)


-Darrel

Ha! Thanks for the feedback, Mark. At least I can find peace with me knowing
that I''m not alone in wanting to stick with it. ;o)

-Darrel


反对匈牙利符号的最大争议是它让它变得更难

来重构代码。人们认为它违反了不要重复自己

(DRY)的原则。就我个人而言,我认为这有点多,但一方

效果是一样的。如果你改变变量的类型,你现在需要改变该变量的所有实例。


如果你有rptBooks并想把它改成一个数据网格,你现在必须

重构你的名字或冒着维护硬代码的风险。


随着IDE的普遍和智能感知的进步,

问题是匈牙利符号提供的价值是什么?


我有兴趣看一下您觉得它广告的代码隐藏页面

价值。


Karl


-
http://www.openmymind.net/
http://www.fuelindustries.com/

" Mark Rae" < ma ** @ markNOSPAMrae.com写信息

新闻:%2 **************** @ TK2MSFTNGP02.phx.gbl ...
The biggest argument against hungarian notation is that it makes it harder
to refactor code. People argue that it''s violates the Don''t Repeat Yourself
(DRY) principle. Personally, I think that''s a little much, but the side
effect IS the same. If you change the type of your variable, you now need to
change all instances of that variable.

if you have rptBooks and want to change it to a datagrid, you now have to
refactor your name or risk having hard code to maintain.

With the advances in IDEs generally and intellisense specifically, the
question is what value does hungarian notation offer?

I''d be interested in taking a look at a codebehind page you feel it ads
value.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...

" darrel" < no ***** @ nowhere.comwrote in message

news:eV ************** @ TK2MSFTNGP06.phx.gbl ...
"darrel" <no*****@nowhere.comwrote in message
news:eV**************@TK2MSFTNGP06.phx.gbl...

>>我刚刚发现MS建议我们不要使用.net框架使用匈牙利语表示法:

http://msdn2.microsoft.com/en-us/library/ ms229045.aspx



很奇怪,不是吗!多年来一直风靡一时,突然之间他们不再像以前那样花了b $ b ...


Weird, isn''t it! It was all the rage for years, then suddenly they don''t
like it any more...


>什么是使用它的真正缺点是什么?
>What are the real cons for using it?



无论如何。


None whatever.


>我倾向于大量使用它,特别是在识别我的控件时。
>I tend to use it a lot, especially when IDing my controls.



我也是 - 所有时间。


Me too - all the time.


>我发现这在代码隐藏时非常有用。
>I find this really helpful when in codebehind.



同样。


Likewise.


>是''没有匈牙利人''仅仅是MS的偏好,
>is the ''no hungarian'' merely a preference MS has,



我不知道......


I have no idea...


>或者我有顽固的特殊缺点并坚持下去?
>or are there specific cons to me being stubborn and sticking with it?



无论如何。


None whatever.


这篇关于为什么不是匈牙利表示法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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