> -----Original Message-----
> From: Gert Franz [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 24, 2004 3:39 AM
> To: CF-Talk
> Subject: AW: AW: Prefixing local variables
> 
> Personally i loved the Hungarian notation. In it's detail it could
> become complicated and generate unreadable code, but if you use a small
> part of it it's quite handy.
> 
> Take this code for eg.
> 
> <cfset var = form.ProductNumber>
> 
> If you write
> 
> <cfset sVar = form.ProductNumber> then you know that the ProductNumber
> not only contains numbers but characters too.

Personally I find this limiting and don't see much gain to be had.  I'm
tired so I might not explain it well, but "ProductNumber" isn't a "String"
or a "number" to me: it's a Product Number.

I have to know what means this "ProductNumber" to work with it and I really
have to know more than just its general type.

What if you begin with only numeric product numbers, then move or add alpha
numeric values?  By defining the variable name this way you have to find
every single place it's used and change it even if it that usage isn't
affected by the change in specification.

If you don't do that (and consistently do that) the notation quickly becomes
untrustworthy (and thus useless).

Also while the prefix gives information about type it doesn't actually
enforce it (at least in CF).  So while the information should be one type,
it really could be another.  The kind of maintenance issues I raised above
could easily lead to this, I think, but so could more prosaic events (like a
change to a supporting database or service).

Lastly it also seems to be me to be a little weak in the area of
self-documentation.  In your example I may know that "ProductNumber" may
contain characters, but I've no idea of anything else (what characters are
allowed, where are they allowed, how long the string is, etc).

To really work with the variable I'm back to really having to know what
"ProductNumber" is and what it really represents.  The prefix doesn't really
help me much there (and no prefix standard really would).  

It seems more work to me in the long run for relatively little gain.

> Well it's only my idea, i use it for about 10 years now and it seems to
> work.

Well, despite my comments above, that's the only defense you need to keep
using it.
 
I doubt you'll ever convince me to use it (and I think we can consider Sean
a lost cause as well), but I would tend to value consistency higher than
esoteric arguments on this.  If it works for you, do it.

But I still wouldn't want to inherit any of your code.  ;^)

Jim Davis




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188744
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