Re: Hungarion Notation is out but..

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



thanks for the coming back to the original question. i share a similar
feeling with respect to HN and at this point feel its ok to prefix the
instance. I am not sure I can keep my team consistent that with naming that
only differentiates in terms of case usage (c# a different story). I think
i am going to go with "aUser".

"Mitchell S. Honnert" <news@honnert~R~E~M~O~V~E~.com> wrote in message
news:%2334$yrbcFHA.2664@xxxxxxxxxxxxxxxxxxxxxxx
> Hello Jeff. It seems like most of the other posts have been focused on
> the merits
> of Hungarian Notation, but because I've found myself in the same dilemma
> as
> you, I'd like to give some input on the original question.
>
> So, if you accept Microsoft's recommendation to avoid HN, how to handle
> the
> following code?
>> dim User as new User
>
> I've found that in most cases, the code I am writing to access an instance
> of a particular class is in some kind of special context that can be used
> in
> the variable name. In other words, I use the type of operation being
> performed on the class to differentiate the class name from the instance
> name. For example, if the person is selecting a User from a ListBox, my
> variable name would be SelectedUser. If I'm getting ready to insert a new
> User into a collection, I would name the variable InsertUser.
>
> Now, admittedly, there isn't always an obvious choice for a "context
> prefix"
> (perhaps because you are writing code that intentionally handles the class
> in any context). Personally, I handle this in one of two ways. The first
> is just to use the My prefix, as in MyUser. Using "My" has always seemed
> a
> bit amateurish to me, but my aversion to HN is strong enough that it
> always
> wins out over any fear that my fellow programmers would make fun of my use
> of "My". The other way (which happens more as a result of my design
> rather
> than another way to avoid this naming conflict) is to imbed the logic
> which uses the instance in a method. For example, my code often contains
> functions in this format...
>
> Public Sub InsertUser(user as User)
>
> I personally am not a fan of C#'s case sensitivity, but VB.NET's case
> "awareness" can come in very handy in this situation. The Microsoft
> naming
> standard specify that parameter names be in camelCase (and "user" is in
> camelCase). So by following this naming standard you can differentiate
> the class name (User) from the instance (user).
>
> HTH.
>
> - Mitchell S. Honnert
>
>
>
>
>
>
>
> "Jeff Jarrell" <jjarrel_NOSPAM@xxxxxxxxx> wrote in message
> news:uHqUlP3bFHA.612@xxxxxxxxxxxxxxxxxxxxxxx
>> Hungarion Notation is out but..
>>
>> I am trying to keep the notion of naming things "it is what it is, name
>> it
>> that"
>>
>> Class Names are an interesting side. If we name them in a meaningful way
>> and then we name an instance of in a meaningful way there will ultimately
>> be a semantic collision.
>>
>> For example,
>>
>> In a VB6 way
>> dim oUser as new clsUser
>>
>> In a .Net way
>> dim User as new User
>>
>> When I read vb6 example, it jumps out at me whether I am refering to the
>> type or the instance. In the .Net way I am not sure from just reading
>> it.
>> (am I using a static function in a type or a function that uses an
>> instances).
>>
>> I am tempted to either suffix the type or prefix the instance. But thats
>> not in the spirit of .net now. Should I just get used to not immediately
>> recognizing the difference between an instance and a type?
>>
>> thanks,
>> jeff
>>
>
>
>


.



Relevant Pages

  • Re: Hungarion Notation is out but..
    ... Hello Jeff. ... of Hungarian Notation, but because I've found myself in the same dilemma as ... Now, admittedly, there isn't always an obvious choice for a "context prefix" ... The Microsoft naming ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Foreign Key Question
    ... we could have 10 people reply and have different opinions on ... But I think the tbl prefix is pretty much frowned upon by ... will have multiple opinions on naming, so you might get more than 10 ... > some prefix naming schemes, e.g. using hr_ to identify human resources ...
    (microsoft.public.sqlserver.programming)
  • Re: How to name variables in a program?
    ... > Having a strong convention for naming your variables in your program is an ... wrote what by looking at its structure, style, format, or naming ... - don't use l, i, O, etc. for local variables. ... - prefix strings with s or str ...
    (comp.programming)
  • Re: Why the m_ before variable names
    ... and member variables then prefix the member variables with "this." ... This is what I call scope-based naming. ... confuse everyone by calling it Hungarian. ... not by its programming language type. ...
    (comp.lang.java.programmer)
  • Re: Attaching SQL Table w/o DSN
    ... tables other then the prefix "MSys"? ... Not sure how it is connected to the original question, ... to spite you. ... attributes to fake a system table. ...
    (comp.databases.ms-access)