TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
View Poll Results: Is Hungarian Notification useful?
Indeed 8 72.73%
Not really 2 18.18%
I don't give a monkeys 1 9.09%
Voters: 11. You may not vote on this poll

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 11-30-2007, 02:52 AM   #1 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Images Hungarian Notation

I use Hungarian notation because you can clearly see what each variable should be containing. Albeit I do admit that with PHP being the way it is, us PHPers shouldn't have to worry about what each variable is storing, as long as it is storing something relevant to our script, right? Well, you're right, but I find it's always nice to care even though there's no call for it.

Here at TalkPHP we seem to love the Hungarian notation (Bluesaga did a little tips guide on them over here), and I have seen 1 or 2 people around the Interweb commenting on the vast amount of TalkPHP's articles about the use of sz for a string. True, sz is technically for a zero-terminated string and PHP does not have those - only C++ to name one. However, the reasoning for that is sz looks nicer than s, and for that I do admit my vanity!

I was merely wondering on other programmer's view on Hungarian notation. For me, I'd rather see:

php Code:
$szMyVariable = 'String';

Than:

php Code:
$myVariable = 'String';

I've seen people giving all sorts of pet names to their variables. In fact, the one and only Winsrev was one of those who had some very peculiar variable names if I remember rightly, but then again, didn't we all at one stage?

Another good thing about the Hungarian notation is that you can enforce variables yourself, even though PHP doesn't seem to care, by extracting the first 1 or 2 variable prefixes and then modifying its data type to match.

For further information on Hungarian notation before sharing your opinion, you may wish to have a read of its Wikipedia page.

So, are we caring too much, or is Hungarian notation really helpful in programming?
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 03:46 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design