What To Do / Not to Do in PowerShell: Part 5
Are these variables names ones that you'd normally use? $strComputer $intCount $objCustom $arrNames If so, you probably have a pretty strong background in VBScript. That style of variable naming is called Hungarian Notation, and it was widely used - and even recommended by Microsoft - for years in the VBScript world.
June 2, 2011
Are these variables names ones that you'd normally use?
$strComputer$intCount$objCustom$arrNames
If so, you probably have a pretty strong background in VBScript. That style of variable naming is called Hungarian Notation, and it was widely used - and even recommended by Microsoft - for years in the VBScript world.
We've moved on.
Typically, it's not crucial - especially in PowerShell - to remember that a variable contains a string, which is what the "str" prefix is supposed to include. Instead, it's more important to know that the variable contains, say, a computer name - which you'd know in your head is a string. Removing those type prefixes can make variable names easier to read, too.
$computername$op_count$custom$names
Hungarian notation is no longer considered a "best practice" by the world in general, or by the broader PowerShell community. So lose the prefix, and stick with straightforward, self-explanatory variable names from here on out!
About the Author
You May Also Like