hungarian-notation

Where does the k prefix for constants come from?

∥☆過路亽.° 提交于 2019-12-02 18:52:49
it's a pretty common practice that constants are prefixed with k (e.g. k_pi ). But what does the k mean? Is it simply that c already meant char ? I haven't seen it that much, but maybe it comes from certain languages' (the germanic ones in particular) spelling of the word constant - konstant . It's a historical oddity, still common practice among teams who like to blindly apply coding standards that they don't understand. Long ago, most commercial programming languages were weakly typed; automatic type checking, which we take for granted now, was still mostly an academic topic. This meant that

What does `m_` variable prefix mean?

匆匆过客 提交于 2019-12-02 14:05:27
I often see m_ prefix used for variables ( m_World , m_Sprites ,...) in tutorials, examples and other code mainly related to game development. Why do people add prefix m_ to variables? This is typical programming practice for defining variables that are member variables. So when you're using them later, you don't need to see where they're defined to know their scope. This is also great if you already know the scope and you're using something like intelliSense , you can start with m_ and a list of all your member variables are shown. Part of Hungarian notation, see the part about scope in the

Best way to get rid of hungarian notation?

坚强是说给别人听的谎言 提交于 2019-12-01 18:08:53
Let's say you've inherited a C# codebase that uses one class with 200 static methods to provide core functionality (such as database lookups). Of the many nightmares in that class, there's copious use of Hungarian notation (the bad kind). Would you refactor the variable names to remove the Hungarian notation, or would you leave them alone? If you chose to change all the variables to remove Hungarian notation, what would be your method? Just leave it alone. There are better uses of your time. Refactor -- I find Hungarian notation on that scale really interferes with the natural readability of

Why shouldn't I prefix my fields? [closed]

杀马特。学长 韩版系。学妹 提交于 2019-11-30 06:20:26
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I've never been a fan of Hungarian notation, I've always found it pretty useless unless you're doing some really low level programming

Are variable prefixes (“Hungarian notation”) really necessary anymore? [closed]

你。 提交于 2019-11-30 01:19:21
Since C# is strongly typed, do we really need to prefix variables anymore? e.g. iUserAge iCounter strUsername I used to prefix in the past, but going forward I don't see any benefit . Are variable prefixes ( Hungarian ) really necessary anymore? NO! In fact, Microsoft's own style guidelines (where the practice originated) now recommend against it. In particular, see the section on General Naming Conventions , which includes the following text (in bold type, no less): Do not use Hungarian notation. The only places I see fit to bend the standards and prefix variables: control names: txtWhatever

Class names that start with C

依然范特西╮ 提交于 2019-11-29 13:24:21
The MFC has all class names that start with C. For example, CFile and CGdiObject. Has anyone seen it used elsewhere? Is there an official naming convention guide from Microsoft that recommends this style? Did the idea originate with MFC or was it some other project? Something a bit similar is used in Symbian C++, where the convention is that: T classes are "values", for example TChar, TInt32, TDes R classes are handles to kernel (or other) resources, for example RFile, RSocket M classes are mixins, which includes interfaces (construed as mixins with no function implementations). The guideline

textBoxEmployeeName vs employeeNameTextBox

折月煮酒 提交于 2019-11-29 01:41:26
Which naming convention do you use and why? I like to use employeeNameTextBox, because: It seems more natural from an English language perspective. I find it's easier to look up with Intellisense. The convention is similar to the convention used for events (MouseClickEvent, MouseClickEventHandler) and dependency properties (VisiblityProperty). Note: I am using the full name rather than an abbreviation (such as "tb"), because it is in line with MS's naming conventions that say to avoid using abbreviations. http://msdn.microsoft.com/en-us/library/ms229045.aspx The only reason to use the control

Are variable prefixes (“Hungarian notation”) really necessary anymore? [closed]

隐身守侯 提交于 2019-11-28 22:08:47
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Since C# is strongly typed, do we really need to prefix variables anymore? e.g. iUserAge iCounter strUsername I used to prefix in the

Why shouldn't I prefix my fields? [closed]

蓝咒 提交于 2019-11-28 17:24:41
I've never been a fan of Hungarian notation, I've always found it pretty useless unless you're doing some really low level programming, but in every C++ project I've worked on some kind of Hungarian notation policy was enforced, and with it the use of some 'not-really-Hungarian' prefixes as m_ for fields, s_ for statics, g_ for globals and so on. Soon I realized how much useless it was in C# and gradually started to drop all of my old habits... but the 'm_' thing. I still use the m_ prefix on private fields because I really find it very useful to being able to distinguish between parameters,

Do people use the Hungarian Naming Conventions in the real world? [closed]

╄→гoц情女王★ 提交于 2019-11-28 06:46:07
Is it worth learning the convention or is it a bane to readability and maintainability? Considering that most people that use Hungarian Notation is following the misunderstood version of it, I'd say it's pretty pointless. If you want to use the original definition of it, it might make more sense, but other than that it is mostly syntactic sugar. If you read the Wikipedia article on the subject, you'll find two conflicting notations, Systems Hungarian Notation and Apps Hungarian Notation . The original, good, definition is the Apps Hungarian Notation , but most people use the Systems Hungarian