On 27 April 2010 10:45, Greg Keogh <[email protected]> wrote: > · Class/object variables start with an underscore. > > > > This has been discussed and there are mixed feelings in the community. I > personally dins underscores anywhere in source code painful to the eye. > > > > · Method argument variables start with an “a” (argument). > > · Local method variables start with an “l” (local). > > > > I’m surprised no one spanked you over these ones, as Hungarian naming is > OUT. You must be one of the last people on the planet doing that in .NET (I > hope I’m right?!). >
If it was Hungarian, l would mean long, not local, and I think a is used for array of. As in lpsz. (note I'm not defending Hungarian, but it does have its place - vanilla c for instance) > > > Also I switch off all auto formatting so I can do it myself better than the > machine will do it, so you will see my code looking like: > > private string _Name ; // The name that the member is known by > > private string _MemberNumber ; // Membership number > > > > Yoiiks! I don’t like that much. I know they eye is good at looking for > vertical patterns, but I think this differs too much from the bulk of code > around town. We used to have arguments in the 80s about coding COBOL that > vertical alignment way. > I think I've commented in the past that _ and __ can be used by compiler authors. > > > I have a rule I call the 3am rule, you should be able to look at code at 3am > and immediately be able to understand what it does and how it does it. If > you can’t, you need to refactor your code for clarity. > I like that. > > > I wish modern IDEs could take comments in the form of annotations and > callouts in different fonts. Imagine comments like smart tags that could be > mouse hovered and expanded and collapsed and formatted like a word > processor. This would help at 3am. > Imagine code written entirely in comic sans (ducks and runs for cover) -- Meski "Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough" - Adam Hills
