Quick Tip – Avoid abbreviating parameter names

Looking at some of the solutions to the July scripting games problems (here) I noticed that several of them used abbreviations for parameter names.  For instance:

gwmi win32_operatingsystem -co @(".")

I understand that this is a competition of sorts and that part of the challenge is to get a solution with the smallest number of characters, but I realized that I really, really don’t like abbreviated parameter names.

To be clear, these are fine on the command-line (as are aliases, for instance), but I really want to avoid using parameter name abbreviations in my code. For one thing, since PowerShell allows you to use as short an abbreviation as you want as long as it is unambiguous, there is not a single “short form” for a given parameter. In the code above, for example, -co could have been -co, -com, -comp, etc. That leads to inconsistent code and reduces readability in my opinion.
Second, parameter abbreviations are not necessarily stable across PowerShell versions. It’s entirely possible, for instance, that a parameter starting with “co” could be added to in the next version of PowerShell which would make the parameter ambiguous.  At that point, the code is invalid (as well as not very readable).

I know this isn’t a huge deal, but wanted to get my thoughts out here.

Let me know what you think.

p.s.  somehow this got published without the ending.  I just now noticed and updated so it didn’t end in the middle of a sentence.

-Mike