Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I was wondering would it be worth using a form of standard such as Hungarian Notation/Systems Hungarian?

Why would I bother if everything I'm doing now is working fine?

share|improve this question
    
Could you please edit your question to remove the irrelevant parts? It seems you're just asking one thing, and the first three paragraphs are irrelevant. –  S.Lott May 25 '11 at 11:03
1  
possible duplicate of Struggling not to use Hungarian notation –  S.Lott May 25 '11 at 11:03
    
@S.Lott I don't think it is entirely irrelevant (Maybe the "I'm using Git" part is) but obviously if he was on a big team we would tell him to consult his team and not just do whatever he wishes. –  Glenn Nelson May 25 '11 at 11:04
3  
Surprised this hasn't been posted: joelonsoftware.com/articles/Wrong.html –  GreenMatt May 25 '11 at 13:49
    
do you like kludge ? I prefer lean code, but if you need the reminder... just don't expect me to work on it. –  Matthieu M. May 25 '11 at 15:33
add comment

closed as primarily opinion-based by gnat, Kilian Foth, Bart van Ingen Schenau, GlenH7, Dynamic Mar 12 at 20:49

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers

up vote 10 down vote accepted

I have seen the atrocities people commit in the name of hungarian notation. Please don't go there. Today's IDE/Intellisense etc. are more than capable of telling you about the variable type etc.

And then there is the whole issue of untyped languages.

share|improve this answer
add comment

I will answer something opposite of the question. Hungarian notation actually works GREAT with autocomplete.

Say you have a variable, and the name is intHeightOfMonster.

Say you forget the name of the variable

It could be heightOfMonster or MonsterHeight or MeasurementMonsterHeight

You want to be able to type a letter and get the autocomplete suggest to you some variable names.

Knowing that the heightOfMonster is an int, you just type i and voila.

Save time.

share|improve this answer
2  
This actually depend from the ide. In VS typing height will show you the possible variables. Anyway if your ide don't do that, what should I do if i remember the variable name but not it's type? –  Fabio Marcolini Mar 12 at 8:50
add comment

No, it is not worth using any form of Hungarian Notation.

Eric Evans in Domain Driven Design (also available as a mini-book on InfoQ) does an excellent job highlighting the essence of a ubiquitious language:

To create a supple, knowledge-rich design calls for a versatile, shared team language ...

Use the model as the backbone of a language. Commit the team to exercising that language relentlessly in all communication within the team and in the code. Use the same language in diagrams, writing, and especially speech.

The terminology of the day-to-day discussions with the domain experts should not be disconnected from the terminology embedded in the code.

And considering that the code is the most important product of a software project, it is essential that there be little room for anything that doesn't convey the the domain experts concepts and ideas.

In that world, a world where our code reflects the domain, Hungarian notation has absolutely no reason for being.

share|improve this answer
    
The only thing I do is to add a prefix to member variables (m or _) in order to differentiate them from local varables. –  CaseyB May 25 '11 at 18:14
add comment

Well if it is what you prefer, and it makes your code easier to read and understand, then it is a great idea to do. There is of course your typical holy war of not using Systems Hungarian, but if it makes you a more productive code, I say f*ck 'em.

I do however say consider using Apps Hungarian as it is a little more useful in identifying the purpose of a variable (which is what the intention of Hungarian notation was).

The answer here really depends on the language and way you code. For instance, a PHP programmer who makes use of the dynamic typing would not want to use Systems for the fact that the variable wouldn't be correctly pinned down by a type. In this situation I again make my claim towards Apps Hungarian.

share|improve this answer
    
I agree with your point, but I think that just a more descriptive name such as $lastname would obviously mean a string not an integer or anything... –  MattyD May 25 '11 at 11:03
    
@MattyD The variable could be a pointer to a char array. Doesn't really tell you that now does it? –  Glenn Nelson May 25 '11 at 11:06
1  
You sunk my battle ship... I'm mainly a web developer over a software developer so I have never really had to deal with pointers etc... –  MattyD May 25 '11 at 11:08
    
@MattyD I knew I smelled PHP.. but honestly the answer to this question is a bit dependent on his coding style and what language he is using. I mean if he is using PHP and types just don't matter then neither does using Systems Hungarian (Although Apps is another story) –  Glenn Nelson May 25 '11 at 11:10
    
not really. Depending on the language, there is always a standard way of storing strings, be it char array or string class, or whatever. If you intend to point out how a developer can do something that is not standard, keep in mind that he can do the same with notation. –  Davor Ždralo May 25 '11 at 11:14
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.