强调对成员变量preFIX。智能感知 [英] Underscore prefix on member variables. intellisense

查看:147
本文介绍了强调对成员变量preFIX。智能感知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家说的强调,不下划线的争论是纯粹的哲学和用户preference驱动但随着智能影音感有下划线,您可以从您的局部变量区分的成员变量非常方便,从而给你一个具体的受益

everyone said the "underscore, no underscore" debate is purely philosophical and user preference driven but with intelli-sense having the underscore allows you to differentiate your member variables from your local variable very easily and thus giving you a concrete benefit

有任何相反的观点,以有下划线的所有成员变量这样做的好处?

is there any counter argument to this benefit of having underscores to all member variables?

推荐答案

是 - 对一些人来说它降低了可读性。我相信不同的人以不同的方式阅读(有些内部练声曲和别人不一样,例如)。对于一些人(包括我自己)强调中断code流当我读它。

Yes - for some people it reduces readability. I believe different people read in different ways (some internally vocalise and others don't, for instance). For some people (myself included) underscores interrupt the "flow" of code when I'm reading it.

我认为,如果你有告诉本地和实例变量分开,那么很可能要么你的方法困难太大或类是做太多。这并不总是将是当然的情况下,但我不倾向于使用短类/方法都觉得这是一个问题。

I'd argue that if you're having difficulties telling local and instance variables apart, then quite possibly either your methods are too big or your class is doing too much. That's not always going to be the case of course, but I don't tend to find it a problem at all with short classes/methods.

这篇关于强调对成员变量preFIX。智能感知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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