-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I-Lin Kuo wrote:

> A recent blog entry by Sean Corfield has led to this
> thought:
> 
> http://www.corfield.org/blog/?mode=entry&entry=D1CB9656-0284-4F53-209C8F9F6159FB8D
> 
> It seems to me that the primary argument given for the
> use of Hungarian notation to signify data types is to
> allow the naming convention to compensate for weakly
> typed languages like CF and VB. It's proponents argue
> that using Hungarian notation allows them to see at a
> glance the type of the variable without having to
> search through code.

Slight correction there: VB is, in fact, strongly typed as long as you
avoid using variants, which subvert its strong typing.

> I think there is another better solution to this
> problem -- let the IDE and the language solve this
> together. For example, when using the Eclipse IDE for
> Java, hovering over a variable name brings up the
> JavaDocs for that variable, showing its type
> information as well as any comments by the author
> about its intended usage. This information would be
> far more useful than the mere knowledge of the
> variable type. If CF were to add some kind of
> JavaDoc-like annotation feature, then I don't think
> there would be any more arguments about CF and
> Hungarian notation (excluding notepad and emacs users
> :) ....

Well, yes and no. I don't use HN myself (although I do use something
similar, and I think most programmers do unconsciously), but I
understand the reasoning behind it.

Disregard all the stupid corrupt forms (the ones where you prefix the
likes of 'str', 'int', 'flt', 'tbl', 'dw', &c.), and go read Simonyi's
original description[1]. The error people made when reading this was to
confuse the meaning of the word 'type'. Simonyi was talking about
semantics--that is, logical types--rather than physical types. For
instance if you have an integer, and you're using it as an index, you'd
prefix this with 'i', e.g. 'iMessage', and counter might be called
'cUnits'.

This is very, very different from the VB-style HN that most people on
this list have probably been in contact with, where you prefix the
physical type to the variable (which is just a little dumb). Case in
point: prefixing variants with 'vnt', tables with 'tbl', &c. This kind
of notation sprung from two sources: C-programmers who learned Windows
programming from Petzold[2] and picked up 'HN' there, and from reading
code produced by the systems group in MS. Both sources made the
unfortunate error of confusing physical types with the types Simonyi was
talking about. The VB crowd just compounded this to the mess we have
today.

Most of the conventions in the original HN are actually useful in any
language, primarily because most of the things in it are things you
put in names anyway. Mind you, some of them, such as the 'p' and 'sz'
prefixes are C-specific, and though I personally thing 'sz' isn't
particularly useful (unless you're dealing with a whole bunch of
different string types that look otherwise identical, like you might
in C), though 'p' *is* useful if you're dealing with pointers a lot.

Sorry for the ramble. If you haven't already read it, you should read
Joel Spolsky's original article[3], which is what triggered Sean to
write his one. Also, Larry Osterman's last blog entry on the topic[4]
is worth a look.

K.

[1] http://msdn.microsoft.com/library/en-us/dnvs600/html/HungaNotat.asp
[2] http://www.charlespetzold.com/pw5/
[3] http://www.joelonsoftware.com/articles/Wrong.html
[4] http://blogs.msdn.com/larryosterman/archive/2004/06/22/162629.aspx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCiJ6VmSWF0pzlQ04RAj98AKCTbPq4TleveCLQTjZO+sBArTjsTwCeOEui
pzrUM9eiWgF3QkHmBjersgI=
=QHQh
-----END PGP SIGNATURE-----

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206762
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to