Declaring variables in programming
I am putting this out to those of you that do a lot of coding. I am in a Visual Basic course right now, against my will ;(, and my teacher is having us declare variables with Hungarian notation. I have been coding C and Bash shell scripts in Linux for a few years and have never done it, nor have I ever seen it in a book.
For those that may not know what this is, it is declaring the variable type in the name; for example dblNumberOne or intTempOne. I was just curious, this teacher seems to be pretty good but his code sometimes makes no sense or he do things certain ways, just because that is the way you are supposed to do them, giving us no reason for it.
It seems to have become popular within Microsoft and effectively exported from there. Being your instructor is teaching VB, it should be no surprise he is using it.
It isn't right or wrong, but can be very helpful. I suggest you stay open to the idea. You might find the idea helpful in the future. It is a quick way recognize the type you are using and if it makes sense in the context you are about to place the variable in. Also, when it is expected that others with be working on the code, it may be a good convention to follow.
Class should have opportunities for two way discussion, so I suggest you note those times where things don't make sense and either raise the question during class or discuss it later one on one. Be proactive.
Hmm, I hadn't heard of that convention before, but when you think about it I suppose it could make a lot of sense...
It would certainly help to avoid type mismatch errors :)
|All times are GMT -4. The time now is 12:17 PM.|
Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.