473,795 Members | 3,358 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Letting go of Hungarian Notation

Just seeking some advice (or solace)...
Am I the only who's having trouble letting go of notation? Having extensive
experience in C++ years ago (both before I jumped into VB3 in college and at
various times during my VB career), I welcomed the "richly-typed" .NET
framework. But, after almost *two years* of "giving it a chance," I still
insist that using notation for the "common" (mostly value-types) types
(string, integer, boolean, etc.) is extremely beneficial. I can instantly
see that I'm dealing with a declared variable in my procedure rather than a
property or some framework object. Even using "o" to denote other
instantiated (reference) objects is beneficial because I can instantly see
that I'm dealing with an actual instantiated object rather than some
"Shared" Class.

Here are some of the standards I've adopted after almost two years of
experience in .NET.
1) Use all the old VB standards for intrinsic types (s,i,b,dt, etc.-- yeah I
dropped the 3 letter notation for simple types years ago) with some new
additions for commonly used Framework objects (sb for StringBuilder, for
instance).
2) "o" for all other lesser used framework types and instantiated objects.
3) All the old VB notations for the most common controls (lbl,btn,txt,pi c,
etc.). Derived controls and fancy custom controls get noted according to
their purpose or roots (i.e. "fancy buttons" still get the "btn" notation).
4) "m_" or the more c#-like "_" to denote module-level variables.
5) "g_" for global variables.
6) All Caps for global constants.
7) I even tried to keep notation out of my procedure parameters... but
decided I liked those too (although I agree that they're ugly when seen
through intellisense).

So on and so forth. I should also note that I'm not a "resistor". ... I tried
very hard to be open-minded. I've enthusiasticall y accepted a lot of the
..NET conventions (structured error handling, options strict on, using
framework objects as oppossed to the legacy VB equivalents (where
appropriate... i.e. Mid/Left/Right still beats String.Substrin g() anyday if
only because of the graceful error handling )).

Any comments, advice? (P.S. I'm not an old fogey (28).... but I have been
coding since I was 13. Maybe that's the problem!) *Sigh.*
Nov 20 '05
19 1765
I think this notation is someone's personal brainchild

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
<cm****@nospam. com> wrote in message
news:eh******** ******@tk2msftn gp13.phx.gbl...
I've never ever quite seen that notation I don't think. Maybe a Pascal
derivative? I dunno. So all your variables are noted with "v"... hmm...
that's a "Variant" to me. Classically the notation I use (and what I always thought was a common VB standard) is a descendent of the classic C
conventions (str, int, bln, etc). I've worked with people that use p to
denote proc parameters in VB but that annoys me (p is a pointer in C++).

"The Grim Reaper" <gr*********@bt openworld.com> wrote in message
news:ca******** **@titan.btinte rnet.com...
Hmmmm.. none of your notations seem to match the way I was taught :S Most
bizarre!!

I started programming at 12ish (25 now), and when I moved to VB at 16, I

was
taught Hungarian notation. I later got my first "profession al" job at 19, and the company I worked for had a strict standard which for some unknown reason I have followed ever since...

1) Module variables prefixed mv
2) Class variables prefixed cv (although I usually just use mv...)
3) "Normal" variables prefixed v
4) Variables that have been passed into a procedure prefixed p (Function Foo(pName as string, pType as... etc)
5) All the usual txt, lbl, dlg for controls, except it's cmd for command buttons ( :S !!)
6) Global vars prefixed gv
7) Constants the same as above - gc or mc - not in capitals

God only knows why I've stuck to this notation (fear of going through a
billion lines or source code to change it all I suppose :)) ) Does anyone know where this form of notation might have originated??
_______________ _______________ _____
The Grim Reaper

<cm****@nospam. com> wrote in message
news:um******** ******@TK2MSFTN GP11.phx.gbl...
Just seeking some advice (or solace)...
Am I the only who's having trouble letting go of notation? Having

extensive
experience in C++ years ago (both before I jumped into VB3 in college and
at
various times during my VB career), I welcomed the "richly-typed" .NET
framework. But, after almost *two years* of "giving it a chance," I

still insist that using notation for the "common" (mostly value-types) types
(string, integer, boolean, etc.) is extremely beneficial. I can instantly see that I'm dealing with a declared variable in my procedure rather than
a
property or some framework object. Even using "o" to denote other
instantiated (reference) objects is beneficial because I can instantly

see that I'm dealing with an actual instantiated object rather than some
"Shared" Class.

Here are some of the standards I've adopted after almost two years of
experience in .NET.
1) Use all the old VB standards for intrinsic types (s,i,b,dt, etc.-- yeah
I
dropped the 3 letter notation for simple types years ago) with some new additions for commonly used Framework objects (sb for StringBuilder, for instance).
2) "o" for all other lesser used framework types and instantiated

objects. 3) All the old VB notations for the most common controls (lbl,btn,txt,pi c, etc.). Derived controls and fancy custom controls get noted according to their purpose or roots (i.e. "fancy buttons" still get the "btn"

notation).
4) "m_" or the more c#-like "_" to denote module-level variables.
5) "g_" for global variables.
6) All Caps for global constants.
7) I even tried to keep notation out of my procedure parameters... but
decided I liked those too (although I agree that they're ugly when seen through intellisense).

So on and so forth. I should also note that I'm not a "resistor". ... I

tried
very hard to be open-minded. I've enthusiasticall y accepted a lot of the .NET conventions (structured error handling, options strict on, using
framework objects as oppossed to the legacy VB equivalents (where
appropriate... i.e. Mid/Left/Right still beats String.Substrin g()
anyday if
only because of the graceful error handling )).

Any comments, advice? (P.S. I'm not an old fogey (28).... but I have

been coding since I was 13. Maybe that's the problem!) *Sigh.*



Nov 20 '05 #11
Well, as long as its consistent even alien conventions are useful. It's easy
maintaining someone else's applications as long as the coding style is
*consistent* throughout the project.

Having said that, and being a big believer in consistency, I'm worried that
*my* conventions will at some point clash with the larger .NET universe and
it will become harder and harder for me to stick with them. I'm lucky right
now because my partners believe as I do... and many other coders who
contribute code and controls to places such as CodeProject or GotDotNet use
very VB3/4/5/6-esque conventions. But at some point in the future I see the
entire style meeting its death.
"One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message
news:e$******** ******@tk2msftn gp13.phx.gbl...
I think this notation is someone's personal brainchild

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
<cm****@nospam. com> wrote in message
news:eh******** ******@tk2msftn gp13.phx.gbl...
I've never ever quite seen that notation I don't think. Maybe a Pascal
derivative? I dunno. So all your variables are noted with "v"... hmm...
that's a "Variant" to me. Classically the notation I use (and what I always
thought was a common VB standard) is a descendent of the classic C
conventions (str, int, bln, etc). I've worked with people that use p to
denote proc parameters in VB but that annoys me (p is a pointer in C++).

"The Grim Reaper" <gr*********@bt openworld.com> wrote in message
news:ca******** **@titan.btinte rnet.com...
Hmmmm.. none of your notations seem to match the way I was taught :S Most bizarre!!

I started programming at 12ish (25 now), and when I moved to VB at 16, I
was
taught Hungarian notation. I later got my first "profession al" job at 19, and the company I worked for had a strict standard which for some unknown reason I have followed ever since...

1) Module variables prefixed mv
2) Class variables prefixed cv (although I usually just use mv...)
3) "Normal" variables prefixed v
4) Variables that have been passed into a procedure prefixed p (Function Foo(pName as string, pType as... etc)
5) All the usual txt, lbl, dlg for controls, except it's cmd for command buttons ( :S !!)
6) Global vars prefixed gv
7) Constants the same as above - gc or mc - not in capitals

God only knows why I've stuck to this notation (fear of going through
a billion lines or source code to change it all I suppose :)) ) Does anyone know where this form of notation might have originated??
_______________ _______________ _____
The Grim Reaper

<cm****@nospam. com> wrote in message
news:um******** ******@TK2MSFTN GP11.phx.gbl...
> Just seeking some advice (or solace)...
> Am I the only who's having trouble letting go of notation? Having
extensive
> experience in C++ years ago (both before I jumped into VB3 in college and
at
> various times during my VB career), I welcomed the "richly-typed"
..NET > framework. But, after almost *two years* of "giving it a chance," I

still
> insist that using notation for the "common" (mostly value-types) types > (string, integer, boolean, etc.) is extremely beneficial. I can

instantly
> see that I'm dealing with a declared variable in my procedure rather

than
a
> property or some framework object. Even using "o" to denote other
> instantiated (reference) objects is beneficial because I can instantly
see
> that I'm dealing with an actual instantiated object rather than some
> "Shared" Class.
>
> Here are some of the standards I've adopted after almost two years
of > experience in .NET.
> 1) Use all the old VB standards for intrinsic types (s,i,b,dt, etc.-- yeah
I
> dropped the 3 letter notation for simple types years ago) with some

new > additions for commonly used Framework objects (sb for StringBuilder, for > instance).
> 2) "o" for all other lesser used framework types and instantiated

objects.
> 3) All the old VB notations for the most common controls

(lbl,btn,txt,pi c,
> etc.). Derived controls and fancy custom controls get noted
according to > their purpose or roots (i.e. "fancy buttons" still get the "btn"
notation).
> 4) "m_" or the more c#-like "_" to denote module-level variables.
> 5) "g_" for global variables.
> 6) All Caps for global constants.
> 7) I even tried to keep notation out of my procedure parameters...
but > decided I liked those too (although I agree that they're ugly when

seen > through intellisense).
>
> So on and so forth. I should also note that I'm not a "resistor". ... I tried
> very hard to be open-minded. I've enthusiasticall y accepted a lot of the > .NET conventions (structured error handling, options strict on, using > framework objects as oppossed to the legacy VB equivalents (where
> appropriate... i.e. Mid/Left/Right still beats String.Substrin g() anyday if
> only because of the graceful error handling )).
>
> Any comments, advice? (P.S. I'm not an old fogey (28).... but I have

been
> coding since I was 13. Maybe that's the problem!) *Sigh.*
>
>



Nov 20 '05 #12
I agree with you, any method is better than no method, because at least if
you have a method one can then criticise its patterns and processes (
something to point at so to speak. )

I'm not sure if there is a globally accepted coding convention for .NET
really, but MS have their own view, although so do others.

The one convention I will not use is the m_ , it drives me insane having to
do underscores all the time.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
<cm****@nospam. com> wrote in message
news:O$******** *****@TK2MSFTNG P11.phx.gbl...
Well, as long as its consistent even alien conventions are useful. It's easy maintaining someone else's applications as long as the coding style is
*consistent* throughout the project.

Having said that, and being a big believer in consistency, I'm worried that *my* conventions will at some point clash with the larger .NET universe and it will become harder and harder for me to stick with them. I'm lucky right now because my partners believe as I do... and many other coders who
contribute code and controls to places such as CodeProject or GotDotNet use very VB3/4/5/6-esque conventions. But at some point in the future I see the entire style meeting its death.
"One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message news:e$******** ******@tk2msftn gp13.phx.gbl...
I think this notation is someone's personal brainchild

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
<cm****@nospam. com> wrote in message
news:eh******** ******@tk2msftn gp13.phx.gbl...
I've never ever quite seen that notation I don't think. Maybe a Pascal
derivative? I dunno. So all your variables are noted with "v"... hmm... that's a "Variant" to me. Classically the notation I use (and what I always
thought was a common VB standard) is a descendent of the classic C
conventions (str, int, bln, etc). I've worked with people that use p to denote proc parameters in VB but that annoys me (p is a pointer in C++).
"The Grim Reaper" <gr*********@bt openworld.com> wrote in message
news:ca******** **@titan.btinte rnet.com...
> Hmmmm.. none of your notations seem to match the way I was taught :S

Most
> bizarre!!
>
> I started programming at 12ish (25 now), and when I moved to VB at 16, I
was
> taught Hungarian notation. I later got my first "profession al" job
at
19,
> and the company I worked for had a strict standard which for some unknown
> reason I have followed ever since...
>
> 1) Module variables prefixed mv
> 2) Class variables prefixed cv (although I usually just use mv...)
> 3) "Normal" variables prefixed v
> 4) Variables that have been passed into a procedure prefixed p

(Function
> Foo(pName as string, pType as... etc)
> 5) All the usual txt, lbl, dlg for controls, except it's cmd for

command
> buttons ( :S !!)
> 6) Global vars prefixed gv
> 7) Constants the same as above - gc or mc - not in capitals
>
> God only knows why I've stuck to this notation (fear of going
through a > billion lines or source code to change it all I suppose :)) ) Does anyone
> know where this form of notation might have originated??
> _______________ _______________ _____
> The Grim Reaper
>
> <cm****@nospam. com> wrote in message
> news:um******** ******@TK2MSFTN GP11.phx.gbl...
> > Just seeking some advice (or solace)...
> > Am I the only who's having trouble letting go of notation? Having
> extensive
> > experience in C++ years ago (both before I jumped into VB3 in college and
> at
> > various times during my VB career), I welcomed the "richly-typed" .NET > > framework. But, after almost *two years* of "giving it a chance,"
I still
> > insist that using notation for the "common" (mostly value-types)

types > > (string, integer, boolean, etc.) is extremely beneficial. I can
instantly
> > see that I'm dealing with a declared variable in my procedure rather than
> a
> > property or some framework object. Even using "o" to denote other
> > instantiated (reference) objects is beneficial because I can instantly see
> > that I'm dealing with an actual instantiated object rather than some > > "Shared" Class.
> >
> > Here are some of the standards I've adopted after almost two years of > > experience in .NET.
> > 1) Use all the old VB standards for intrinsic types (s,i,b,dt, etc.-- yeah
> I
> > dropped the 3 letter notation for simple types years ago) with some new
> > additions for commonly used Framework objects (sb for
StringBuilder,
for
> > instance).
> > 2) "o" for all other lesser used framework types and instantiated
objects.
> > 3) All the old VB notations for the most common controls
(lbl,btn,txt,pi c,
> > etc.). Derived controls and fancy custom controls get noted according
to
> > their purpose or roots (i.e. "fancy buttons" still get the "btn"
> notation).
> > 4) "m_" or the more c#-like "_" to denote module-level variables.
> > 5) "g_" for global variables.
> > 6) All Caps for global constants.
> > 7) I even tried to keep notation out of my procedure parameters...

but > > decided I liked those too (although I agree that they're ugly when

seen
> > through intellisense).
> >
> > So on and so forth. I should also note that I'm not a
"resistor". ... I > tried
> > very hard to be open-minded. I've enthusiasticall y accepted a lot
of the
> > .NET conventions (structured error handling, options strict on,

using > > framework objects as oppossed to the legacy VB equivalents (where
> > appropriate... i.e. Mid/Left/Right still beats String.Substrin g()

anyday
> if
> > only because of the graceful error handling )).
> >
> > Any comments, advice? (P.S. I'm not an old fogey (28).... but I

have been
> > coding since I was 13. Maybe that's the problem!) *Sigh.*
> >
> >
>
>



Nov 20 '05 #13
* <cm****@nospam. com> scripsit:
I've never ever quite seen that notation I don't think. Maybe a Pascal
derivative? I dunno. So all your variables are noted with "v"... hmm...
that's a "Variant" to me. Classically the notation I use (and what I always
thought was a common VB standard) is a descendent of the classic C
conventions (str, int, bln, etc). I've worked with people that use p to
denote proc parameters in VB but that annoys me (p is a pointer in C++).


Some people used 'f' to denote function procedures...

;-)

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #14
I didn't realise about lpsz and p prefixes in C++ until a year ago - I've
somehow managed to carefully avoid all forms of C over the years :D (I
started on Amigas with Blitz Basic and AmigaDos... hehe)

I agree with the m_ thing - another thing I do that really annoys people is
use Verdana in the IDE... (I can tell you lot don't like me already...
lol) - and underscores become unreadable in tight coded sections. Still -
at least I don't use Times New Roman...

It's hard to change a convention once you get used to it. After using the
one I use for 4 years now, reading other people's code is slow and sometimes
error-prone to me. I'm changing jobs back to full time VB/.NET programming
soon, so I'll no doubt be learning a whole new convention to fit in with the
company I'll hopefully join!!
_______________ _______________ _
The Grimy Raper

"One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message
news:%2******** *******@tk2msft ngp13.phx.gbl.. .
I agree with you, any method is better than no method, because at least if
you have a method one can then criticise its patterns and processes (
something to point at so to speak. )

I'm not sure if there is a globally accepted coding convention for .NET
really, but MS have their own view, although so do others.

The one convention I will not use is the m_ , it drives me insane having to do underscores all the time.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
<cm****@nospam. com> wrote in message
news:O$******** *****@TK2MSFTNG P11.phx.gbl...
Well, as long as its consistent even alien conventions are useful. It's easy
maintaining someone else's applications as long as the coding style is
*consistent* throughout the project.

Having said that, and being a big believer in consistency, I'm worried

that
*my* conventions will at some point clash with the larger .NET universe

and
it will become harder and harder for me to stick with them. I'm lucky

right
now because my partners believe as I do... and many other coders who
contribute code and controls to places such as CodeProject or GotDotNet

use
very VB3/4/5/6-esque conventions. But at some point in the future I see

the
entire style meeting its death.
"One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in

message
news:e$******** ******@tk2msftn gp13.phx.gbl...
I think this notation is someone's personal brainchild

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
<cm****@nospam. com> wrote in message
news:eh******** ******@tk2msftn gp13.phx.gbl...
> I've never ever quite seen that notation I don't think. Maybe a Pascal > derivative? I dunno. So all your variables are noted with "v"... hmm... > that's a "Variant" to me. Classically the notation I use (and what I
always
> thought was a common VB standard) is a descendent of the classic C
> conventions (str, int, bln, etc). I've worked with people that use p to > denote proc parameters in VB but that annoys me (p is a pointer in C++). >
> "The Grim Reaper" <gr*********@bt openworld.com> wrote in message
> news:ca******** **@titan.btinte rnet.com...
> > Hmmmm.. none of your notations seem to match the way I was taught :S Most
> > bizarre!!
> >
> > I started programming at 12ish (25 now), and when I moved to VB at 16,
I
> was
> > taught Hungarian notation. I later got my first "profession al" job at 19,
> > and the company I worked for had a strict standard which for some
unknown
> > reason I have followed ever since...
> >
> > 1) Module variables prefixed mv
> > 2) Class variables prefixed cv (although I usually just use
mv...) > > 3) "Normal" variables prefixed v
> > 4) Variables that have been passed into a procedure prefixed p
(Function
> > Foo(pName as string, pType as... etc)
> > 5) All the usual txt, lbl, dlg for controls, except it's cmd for
command
> > buttons ( :S !!)
> > 6) Global vars prefixed gv
> > 7) Constants the same as above - gc or mc - not in capitals
> >
> > God only knows why I've stuck to this notation (fear of going through
a
> > billion lines or source code to change it all I suppose :)) ) Does anyone
> > know where this form of notation might have originated??
> > _______________ _______________ _____
> > The Grim Reaper
> >
> > <cm****@nospam. com> wrote in message
> > news:um******** ******@TK2MSFTN GP11.phx.gbl...
> > > Just seeking some advice (or solace)...
> > > Am I the only who's having trouble letting go of notation? Having > > extensive
> > > experience in C++ years ago (both before I jumped into VB3 in college
> and
> > at
> > > various times during my VB career), I welcomed the "richly-typed" .NET
> > > framework. But, after almost *two years* of "giving it a
chance," I > still
> > > insist that using notation for the "common" (mostly value-types) types
> > > (string, integer, boolean, etc.) is extremely beneficial. I can
> instantly
> > > see that I'm dealing with a declared variable in my procedure rather > than
> > a
> > > property or some framework object. Even using "o" to denote
other > > > instantiated (reference) objects is beneficial because I can

instantly
> see
> > > that I'm dealing with an actual instantiated object rather than

some > > > "Shared" Class.
> > >
> > > Here are some of the standards I've adopted after almost two years of
> > > experience in .NET.
> > > 1) Use all the old VB standards for intrinsic types (s,i,b,dt,

etc.--
> yeah
> > I
> > > dropped the 3 letter notation for simple types years ago) with some new
> > > additions for commonly used Framework objects (sb for StringBuilder, for
> > > instance).
> > > 2) "o" for all other lesser used framework types and
instantiated > objects.
> > > 3) All the old VB notations for the most common controls
> (lbl,btn,txt,pi c,
> > > etc.). Derived controls and fancy custom controls get noted

according
to
> > > their purpose or roots (i.e. "fancy buttons" still get the "btn"
> > notation).
> > > 4) "m_" or the more c#-like "_" to denote module-level variables. > > > 5) "g_" for global variables.
> > > 6) All Caps for global constants.
> > > 7) I even tried to keep notation out of my procedure parameters...
but
> > > decided I liked those too (although I agree that they're ugly

when seen
> > > through intellisense).
> > >
> > > So on and so forth. I should also note that I'm not a

"resistor". ...
I
> > tried
> > > very hard to be open-minded. I've enthusiasticall y accepted a lot of the
> > > .NET conventions (structured error handling, options strict on,

using
> > > framework objects as oppossed to the legacy VB equivalents
(where > > > appropriate... i.e. Mid/Left/Right still beats String.Substrin g() anyday
> > if
> > > only because of the graceful error handling )).
> > >
> > > Any comments, advice? (P.S. I'm not an old fogey (28).... but I

have > been
> > > coding since I was 13. Maybe that's the problem!) *Sigh.*
> > >
> > >
> >
> >
>
>



Nov 20 '05 #15
> Anonymouswrote:
... I can instantly
see that I'm dealing with a declared variable in my procedure rather than a property or some framework object. Even using "o" to denote other
instantiated (reference) objects is beneficial because I can instantly see that I'm dealing with an actual instantiated object rather than some "Shared" Class...


Thanks - I thought I was the only one. I use it for exactly the same
reason - I want to be reminded of the types I'm dealing with on a
glance (not a right-click or cursor-hover). I also want to know the
scope at a glance. These advantages will keep hungarian around for
some time I think - I haven't seen any good arguments against it,
although a lot are against it.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 20 '05 #16
I've encountered some books in Oracle PL/SQL programming in which v is the
standard prefix for a variable, especially when distinguishing a program
variable from a field name in the database.

"cm****@nospam. com" wrote:
I've never ever quite seen that notation I don't think. Maybe a Pascal
derivative? I dunno. So all your variables are noted with "v"... hmm...
that's a "Variant" to me. Classically the notation I use (and what I always
thought was a common VB standard) is a descendent of the classic C
conventions (str, int, bln, etc). I've worked with people that use p to
denote proc parameters in VB but that annoys me (p is a pointer in C++).

"The Grim Reaper" <gr*********@bt openworld.com> wrote in message
news:ca******** **@titan.btinte rnet.com...
Hmmmm.. none of your notations seem to match the way I was taught :S Most
bizarre!!

I started programming at 12ish (25 now), and when I moved to VB at 16, I

was
taught Hungarian notation. I later got my first "profession al" job at 19,
and the company I worked for had a strict standard which for some unknown
reason I have followed ever since...

1) Module variables prefixed mv
2) Class variables prefixed cv (although I usually just use mv...)
3) "Normal" variables prefixed v
4) Variables that have been passed into a procedure prefixed p (Function
Foo(pName as string, pType as... etc)
5) All the usual txt, lbl, dlg for controls, except it's cmd for command
buttons ( :S !!)
6) Global vars prefixed gv
7) Constants the same as above - gc or mc - not in capitals

God only knows why I've stuck to this notation (fear of going through a
billion lines or source code to change it all I suppose :)) ) Does anyone
know where this form of notation might have originated??
_______________ _______________ _____
The Grim Reaper

<cm****@nospam. com> wrote in message
news:um******** ******@TK2MSFTN GP11.phx.gbl...
Just seeking some advice (or solace)...
Am I the only who's having trouble letting go of notation? Having

extensive
experience in C++ years ago (both before I jumped into VB3 in college and
at
various times during my VB career), I welcomed the "richly-typed" .NET
framework. But, after almost *two years* of "giving it a chance," I

still insist that using notation for the "common" (mostly value-types) types
(string, integer, boolean, etc.) is extremely beneficial. I can instantly see that I'm dealing with a declared variable in my procedure rather than
a
property or some framework object. Even using "o" to denote other
instantiated (reference) objects is beneficial because I can instantly

see that I'm dealing with an actual instantiated object rather than some
"Shared" Class.

Here are some of the standards I've adopted after almost two years of
experience in .NET.
1) Use all the old VB standards for intrinsic types (s,i,b,dt, etc.-- yeah
I
dropped the 3 letter notation for simple types years ago) with some new
additions for commonly used Framework objects (sb for StringBuilder, for
instance).
2) "o" for all other lesser used framework types and instantiated

objects. 3) All the old VB notations for the most common controls (lbl,btn,txt,pi c, etc.). Derived controls and fancy custom controls get noted according to
their purpose or roots (i.e. "fancy buttons" still get the "btn"

notation).
4) "m_" or the more c#-like "_" to denote module-level variables.
5) "g_" for global variables.
6) All Caps for global constants.
7) I even tried to keep notation out of my procedure parameters... but
decided I liked those too (although I agree that they're ugly when seen
through intellisense).

So on and so forth. I should also note that I'm not a "resistor". ... I

tried
very hard to be open-minded. I've enthusiasticall y accepted a lot of the
.NET conventions (structured error handling, options strict on, using
framework objects as oppossed to the legacy VB equivalents (where
appropriate... i.e. Mid/Left/Right still beats String.Substrin g() anyday

if
only because of the graceful error handling )).

Any comments, advice? (P.S. I'm not an old fogey (28).... but I have been coding since I was 13. Maybe that's the problem!) *Sigh.*



Nov 21 '05 #17
I author computer programming textbooks and teach VB .NET. The use of a
prefix to identify the class of an object or the scope and data tyope of a
variable is quite valuable to programmers, especially beginning programmers.
The demise of this practice is a cardinal error, IMHO.

"cm****@nospam. com" wrote:
Just seeking some advice (or solace)...
Am I the only who's having trouble letting go of notation? Having extensive
experience in C++ years ago (both before I jumped into VB3 in college and at
various times during my VB career), I welcomed the "richly-typed" .NET
framework. But, after almost *two years* of "giving it a chance," I still
insist that using notation for the "common" (mostly value-types) types
(string, integer, boolean, etc.) is extremely beneficial. I can instantly
see that I'm dealing with a declared variable in my procedure rather than a
property or some framework object. Even using "o" to denote other
instantiated (reference) objects is beneficial because I can instantly see
that I'm dealing with an actual instantiated object rather than some
"Shared" Class.

Here are some of the standards I've adopted after almost two years of
experience in .NET.
1) Use all the old VB standards for intrinsic types (s,i,b,dt, etc.-- yeah I
dropped the 3 letter notation for simple types years ago) with some new
additions for commonly used Framework objects (sb for StringBuilder, for
instance).
2) "o" for all other lesser used framework types and instantiated objects.
3) All the old VB notations for the most common controls (lbl,btn,txt,pi c,
etc.). Derived controls and fancy custom controls get noted according to
their purpose or roots (i.e. "fancy buttons" still get the "btn" notation).
4) "m_" or the more c#-like "_" to denote module-level variables.
5) "g_" for global variables.
6) All Caps for global constants.
7) I even tried to keep notation out of my procedure parameters... but
decided I liked those too (although I agree that they're ugly when seen
through intellisense).

So on and so forth. I should also note that I'm not a "resistor". ... I tried
very hard to be open-minded. I've enthusiasticall y accepted a lot of the
..NET conventions (structured error handling, options strict on, using
framework objects as oppossed to the legacy VB equivalents (where
appropriate... i.e. Mid/Left/Right still beats String.Substrin g() anyday if
only because of the graceful error handling )).

Any comments, advice? (P.S. I'm not an old fogey (28).... but I have been
coding since I was 13. Maybe that's the problem!) *Sigh.*

Nov 21 '05 #18
Well, I can see the merits of Hungarian Notation, however, the ECMA
standards for C# do not support this. Microsoft does not seem to want to be
drawn on this point. I have decided to go with the ECMA standards and to be
honest, I have not noticed any appreciable difference in how readable my
code is, in fact if anything it's easier to read because Im not constantly
distracted by prefixes.

IMHO. I think if you write well structured code, the appropriate use of
camelCase and PascalCase as laid out by the ECMA standards is fine.
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"bob_spear" <bo******@discu ssions.microsof t.com> wrote in message
news:BC******** *************** ***********@mic rosoft.com...
I author computer programming textbooks and teach VB .NET. The use of a
prefix to identify the class of an object or the scope and data tyope of a
variable is quite valuable to programmers, especially beginning programmers. The demise of this practice is a cardinal error, IMHO.

"cm****@nospam. com" wrote:
Just seeking some advice (or solace)...
Am I the only who's having trouble letting go of notation? Having extensive experience in C++ years ago (both before I jumped into VB3 in college and at various times during my VB career), I welcomed the "richly-typed" .NET
framework. But, after almost *two years* of "giving it a chance," I still insist that using notation for the "common" (mostly value-types) types
(string, integer, boolean, etc.) is extremely beneficial. I can instantly see that I'm dealing with a declared variable in my procedure rather than a property or some framework object. Even using "o" to denote other
instantiated (reference) objects is beneficial because I can instantly see that I'm dealing with an actual instantiated object rather than some
"Shared" Class.

Here are some of the standards I've adopted after almost two years of
experience in .NET.
1) Use all the old VB standards for intrinsic types (s,i,b,dt, etc.-- yeah I dropped the 3 letter notation for simple types years ago) with some new
additions for commonly used Framework objects (sb for StringBuilder, for
instance).
2) "o" for all other lesser used framework types and instantiated objects. 3) All the old VB notations for the most common controls (lbl,btn,txt,pi c, etc.). Derived controls and fancy custom controls get noted according to
their purpose or roots (i.e. "fancy buttons" still get the "btn" notation). 4) "m_" or the more c#-like "_" to denote module-level variables.
5) "g_" for global variables.
6) All Caps for global constants.
7) I even tried to keep notation out of my procedure parameters... but
decided I liked those too (although I agree that they're ugly when seen
through intellisense).

So on and so forth. I should also note that I'm not a "resistor". ... I tried very hard to be open-minded. I've enthusiasticall y accepted a lot of the
..NET conventions (structured error handling, options strict on, using
framework objects as oppossed to the legacy VB equivalents (where
appropriate... i.e. Mid/Left/Right still beats String.Substrin g() anyday if only because of the graceful error handling )).

Any comments, advice? (P.S. I'm not an old fogey (28).... but I have been coding since I was 13. Maybe that's the problem!) *Sigh.*

Nov 21 '05 #19
I agree. While type (or more correctly semantics) can be implied by a
descriptive variable name, implying scope is difficult without prefixes.
Using m_ for private member variables (or fields as they are known in
.NET) is extremely useful.

Although C# provides the use of 'this.' to disambiguate where compiler
confusion could arise, surely it is far better to disambiguate using a
prefix such as 'm_' so that someone reading the code can disambiguate
wherever it occurs. After all, what's obvious to the compiler may not be
obvious to mere mortals!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
10430
by: Phill | last post by:
Does anyone know the reasoning for Microsoft abandoning Hungarina Notation in C#? I have found it very usefull in C++. I like this style: constant: MY_CONSTANT methos: myMethod() class: MyClass variable: iMyInteger
66
3713
by: CMM | last post by:
So after three years of working in .NET and stubbornly holding on to my old hungarian notation practices--- I resolved to try to rid myself of the habit. Man, I gotta say that it is liberating!!! I love it. At first I struggled with how to name controls. I tried to keep some sort of notation with them... but I threw that away too!!! I now name them as if they were simply properties of the form (FirstNameLabel, etc.)... which they ARE!......
24
3839
by: Ronald S. Cook | last post by:
An ongoing philosophical argument, I would like your opinions. With the release of .NET, Microsoft spoke of moving away from the notation as a best practice. I'm a believer for a few reasons: 1) Consistency throughout and knowing which objects are yours (clsEmployee, tblEmployee, frmEmployee, etc). 2) Not having to name an employee form EmployeeForm.aspx because the mane is already taken by your class named Employee.cs
24
2380
by: darrel | last post by:
I just discovered that MS recommends that we NOT use hungarian notation with the .net framework: http://msdn2.microsoft.com/en-us/library/ms229045.aspx What are the real cons for using it? I tend to use it a lot, especially when IDing my controls. For instance the controls in a contact form I create could be IDed as such:
6
4070
by: Grey Squirrel | last post by:
On wednesday my company will have an open ended discussion whether to standardize hungarian notation or pascal/cammel case notation. We'd love to recieve some feedback on what other people are using out there and why. Thanks!
3
10562
by: Grey Squirrel | last post by:
On wednesday my company will have an open ended discussion whether to standardize hungarian notation or pascal/cammel case notation. We'd love to recieve some feedback on what other people are using out there and why. Thanks!
14
1552
by: Ronald S. Cook | last post by:
I've been weaning myself off of Hungarian notation because that's what Microsoft is telling me to do, and I want to be a good little MS developer. But things keep coming up that make me miss my little 3-character prefixes. I'm fine with EmployeeFirstNameLabel instead of lblEmployeeFirstName, but at the table and class level, I get frustrated because terms I want to use reserved keywords. I wanted "Event" and "User" as classes and table...
18
4251
by: dom.k.black | last post by:
I am looking at starting a new piece of work for a company who are heavily into hungarian notation for C coding. Any killer arguments for NOT carrying this terrible practice forward into new C++ code?
12
3599
by: inhahe | last post by:
Does anybody know of a list for canonical prefixes to use for hungarian notation in Python? Not that I plan to name all my variables with hungarian notation, but just for when it's appropriate.
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9037
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.