I'm reading "Programming in C#" (O'Reilly) and the book states that Microsoft doesn't recommend using Hungarian notation for C#. Can anyone explain why? Does Prestwood Software have a coding convention for C#? I'd be interested in seeing it.
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
PCC C# is currently under development but no target completion date has been set. We are currently looking for contributers so if anyone is interested, let me know.
As for not using hungarian notation, I'm not sure but here are a couple of thoughts:
Hungarian notation is really a throw back to the old large structured programming techniqniques. It was an aid to identifying the type of both local and global variables.
In OO, you deal primarily with objects. Furthermore, when working with objects most do not use hungarian notation (too many objects).
I see nothing wrong with using hungarian notation for "true" local variables within a method. However, with today's promotion of divide and conquer you tend to write much smaller code routines so hungarian notation may be overkill.
Hungarian notation in code has always presented a readability issue. Yes, Microsoft was very gung-ho about Hungarian notation back in the era preceeding object oriented programming, but the change of heart really has to do more with standard practices of object oriented programming, rather than readability.
In C#, as with all current OO languages, the use of global variables is almost non-existent. Instead, you're dealing with objects that have states, and alter those states through messages.
To this end, you want the code to be more readable, not less. Even with method parameters, OO practices lean more toward discrete functions that affect fewer variables, not more, so the parameter lists are often brief and descriptive - and data types are most often inferred from the object a method belongs to.
Even in an application with a large number of data variables, in C#, you're going to be structuring those variables along class boundaries, and reference them through object ownership.
Now, keep in mind these are practices, not mandates. Microsoft isn't saying you can't use Hungarian notation, just that it is out of place in real OO development.
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.